working on songEdit.qml

This commit is contained in:
lordwelch 2016-05-04 10:45:12 -07:00
parent bc809fb8db
commit 5531714b99
4 changed files with 66 additions and 64 deletions

View File

@ -13,10 +13,6 @@ import (
"gopkg.in/gographics/imagick.v2/imagick"
)
var (
fontlst []string
)
/*resizeImage() mw fullsize image
newwidth, newheight = size to be resized to
keepSpecSize = return image with exactly the size specified or just the size of the resized image

15
main.go
View File

@ -16,6 +16,17 @@ import (
//Bool type i'm lazy wanted a toggle function
type Bool bool
type qmlVar struct {
FontList []string
FontLen int
Verses []string
VerseLen int
VerseOrder []string
OrderLen int
Img []string
ImgLen int
}
type cell struct {
text string
img *imagick.MagickWand
@ -88,6 +99,10 @@ func run() error {
setSignals()
slides.add()
//var from GO to qml
QML = &qmlVar{}
engine.Context().SetVar("GO", QML)
//image is ready for imageprovider
imgready = true

12
qml.go
View File

@ -2,12 +2,12 @@
package main
import (
"fmt"
"image"
"path/filepath"
"runtime/debug"
"strconv"
"strings"
"fmt"
"github.com/lordwelch/qml"
)
@ -24,8 +24,16 @@ var (
engine *qml.Engine
quickEdit Bool = false
imgready Bool = false
QML qmlVar
)
func (qv *qmlVar) Changed() {
qml.Changed(qv,qv.VerseLen)
qml.Changed(qv,qv.OrderLen)
qml.Changed(qv,qv.ImgLen)
qml.Changed(qv,qv.FontLen)
}
//signals for the cell and image in qml
func (cl *cell) setSignal() {
cl.qmlcell.ObjectByName("cellMouse").On("clicked", func(musEvent qml.Object) {
@ -159,7 +167,7 @@ func edtQmlShow() {
var slc *[]string
edtQml.Common.ObjectByName("fontPicker").List("model").Convert(slc)
fmt.Println(slc)
}
}
//imgProvider() for preview images in QML
func imgProvider(id string, width, height int) image.Image {

View File

@ -1,7 +1,8 @@
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Controls 1.4
import QtQuick.Layouts 1.1
import QtQuick.Dialogs 1.2
//import Qt.labs.controls 1.0
ApplicationWindow {
minimumHeight: 480
@ -77,7 +78,7 @@ ApplicationWindow {
Label {
id: label1
text: qsTr("Label")
text: qsTr("Verses")
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
}
ListView {
@ -93,30 +94,15 @@ ApplicationWindow {
focus: true
keyNavigationWraps: true
boundsBehavior: Flickable.StopAtBounds
model: ListModel {
ListElement {
name: "v1"
}
ListElement {
name: "v2"
}
ListElement {
name: "v3"
}
ListElement {
name: "v4"
}
ListElement {
name: "v5"
}
}
model: GO.verseLen
delegate: Item {
x: 5
width: 80
height: 40
Text {
text: name
text: GO.verses(index)
anchors.verticalCenter: parent.verticalCenter
font.bold: true
}
@ -131,7 +117,7 @@ ApplicationWindow {
Label {
id: label2
text: qsTr("Label")
text: qsTr("Verse Order")
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
}
ListView {
@ -145,30 +131,14 @@ ApplicationWindow {
Layout.fillHeight: true
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
boundsBehavior: Flickable.StopAtBounds
model: ListModel {
ListElement {
name: "v1"
}
ListElement {
name: "v2"
}
ListElement {
name: "v3"
}
ListElement {
name: "v4"
}
ListElement {
name: "v5"
}
}
model: GO.orderLen
delegate: Item {
x: 5
width: 80
height: 40
Text {
text: name
text: GO.verseOrder(index)
anchors.verticalCenter: parent.verticalCenter
font.bold: true
}
@ -211,7 +181,11 @@ ApplicationWindow {
id: fontPicker
objectName: "fontPicker"
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
model: ["test","test1","test2"]
model: GO.fontLen
// @disable-check M16
/*delegate:Text {
text: GO.fontList(index)
}*/
}
@ -222,7 +196,6 @@ ApplicationWindow {
maximumValue: 1000
value: 1
suffix: "Pt"
}
SpinBox {
@ -247,12 +220,21 @@ ApplicationWindow {
ComboBox {
id: versePicker
objectName: "versePicker"
model: GO.verseLen
// @disable-check M16
/* delegate: Text {
text: GO.verses(index)
}*/
}
ComboBox {
id: imgPicker
objectName: "imgPicker"
}
model: GO.imgLen
// @disable-check M16
/*delegate: Text {
text: GO.img(index)
}*/
}
TextArea {
id: textEdit1
@ -269,4 +251,5 @@ ApplicationWindow {
}
}
}
}
}