add qlobal qml var for songEdit.qml
This commit is contained in:
parent
5531714b99
commit
7fe593a4ef
@ -160,7 +160,8 @@ func findfonts() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
log.Print(err)
|
log.Print(err)
|
||||||
}
|
}
|
||||||
fontlst = strings.Split(out.String(), "\n")
|
QML.FontList = strings.Split(out.String(), "\n")
|
||||||
|
QML.FontLen = len(QML.FontList)
|
||||||
}
|
}
|
||||||
|
|
||||||
func round(a float64) int {
|
func round(a float64) int {
|
||||||
|
8
main.go
8
main.go
@ -63,9 +63,11 @@ func main() {
|
|||||||
|
|
||||||
func run() error {
|
func run() error {
|
||||||
imagick.Initialize()
|
imagick.Initialize()
|
||||||
findfonts()
|
|
||||||
|
|
||||||
engine = qml.NewEngine()
|
engine = qml.NewEngine()
|
||||||
|
QML = &qmlVar{}
|
||||||
|
engine.Context().SetVar("go", QML)
|
||||||
|
findfonts()
|
||||||
engine.AddImageProvider("images", imgProvider)
|
engine.AddImageProvider("images", imgProvider)
|
||||||
//path for qml files TODO: change to somewhere else
|
//path for qml files TODO: change to somewhere else
|
||||||
path, err = osext.ExecutableFolder()
|
path, err = osext.ExecutableFolder()
|
||||||
@ -92,7 +94,7 @@ func run() error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
window = mainQml.CreateWindow(engine.Context())
|
window = mainQml.CreateWindow(engine.Context())
|
||||||
window2 := edtQml.CreateWindow(engine.Context())
|
window2 = edtQml.CreateWindow(engine.Context())
|
||||||
|
|
||||||
textEdit = window.ObjectByName("textEdit")
|
textEdit = window.ObjectByName("textEdit")
|
||||||
//signals for whole qml
|
//signals for whole qml
|
||||||
@ -100,8 +102,6 @@ func run() error {
|
|||||||
slides.add()
|
slides.add()
|
||||||
|
|
||||||
//var from GO to qml
|
//var from GO to qml
|
||||||
QML = &qmlVar{}
|
|
||||||
engine.Context().SetVar("GO", QML)
|
|
||||||
|
|
||||||
//image is ready for imageprovider
|
//image is ready for imageprovider
|
||||||
imgready = true
|
imgready = true
|
||||||
|
20
qml.go
20
qml.go
@ -21,17 +21,24 @@ var (
|
|||||||
edtQml qml.Object
|
edtQml qml.Object
|
||||||
textEdit qml.Object
|
textEdit qml.Object
|
||||||
window *qml.Window
|
window *qml.Window
|
||||||
|
window2 *qml.Window
|
||||||
engine *qml.Engine
|
engine *qml.Engine
|
||||||
quickEdit Bool = false
|
quickEdit Bool = false
|
||||||
imgready Bool = false
|
imgready Bool = false
|
||||||
QML qmlVar
|
QML *qmlVar
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func initQML() {
|
||||||
|
window2.ObjectByName("textClrDialog").On("accepted", func() {
|
||||||
|
window2.ObjectByName("textClrDialog").Color("color")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
func (qv *qmlVar) Changed() {
|
func (qv *qmlVar) Changed() {
|
||||||
qml.Changed(qv,qv.VerseLen)
|
qml.Changed(qv, qv.VerseLen)
|
||||||
qml.Changed(qv,qv.OrderLen)
|
qml.Changed(qv, qv.OrderLen)
|
||||||
qml.Changed(qv,qv.ImgLen)
|
qml.Changed(qv, qv.ImgLen)
|
||||||
qml.Changed(qv,qv.FontLen)
|
qml.Changed(qv, qv.FontLen)
|
||||||
}
|
}
|
||||||
|
|
||||||
//signals for the cell and image in qml
|
//signals for the cell and image in qml
|
||||||
@ -164,8 +171,7 @@ func setSignals() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func edtQmlShow() {
|
func edtQmlShow() {
|
||||||
var slc *[]string
|
slc := window2.ObjectByName("fontPicker").Property("model")
|
||||||
edtQml.Common.ObjectByName("fontPicker").List("model").Convert(slc)
|
|
||||||
fmt.Println(slc)
|
fmt.Println(slc)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,7 +82,8 @@ ApplicationWindow {
|
|||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
}
|
}
|
||||||
ListView {
|
ListView {
|
||||||
id: listView1
|
id: lstVerses
|
||||||
|
objectName: "lstVerses"
|
||||||
clip: true
|
clip: true
|
||||||
highlight: Rectangle {
|
highlight: Rectangle {
|
||||||
color: "lightsteelblue"
|
color: "lightsteelblue"
|
||||||
@ -94,7 +95,7 @@ ApplicationWindow {
|
|||||||
focus: true
|
focus: true
|
||||||
keyNavigationWraps: true
|
keyNavigationWraps: true
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
model: GO.verseLen
|
model: go.verseLen
|
||||||
|
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
x: 5
|
x: 5
|
||||||
@ -102,7 +103,7 @@ ApplicationWindow {
|
|||||||
height: 40
|
height: 40
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: GO.verses(index)
|
text: go.verses(index)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
@ -121,7 +122,8 @@ ApplicationWindow {
|
|||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
}
|
}
|
||||||
ListView {
|
ListView {
|
||||||
id: listView2
|
id: lstOrder
|
||||||
|
objectName: "lstOrder"
|
||||||
clip: true
|
clip: true
|
||||||
highlight: Rectangle {
|
highlight: Rectangle {
|
||||||
color: "lightsteelblue"
|
color: "lightsteelblue"
|
||||||
@ -131,14 +133,14 @@ ApplicationWindow {
|
|||||||
Layout.fillHeight: true
|
Layout.fillHeight: true
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
boundsBehavior: Flickable.StopAtBounds
|
boundsBehavior: Flickable.StopAtBounds
|
||||||
model: GO.orderLen
|
model: go.orderLen
|
||||||
delegate: Item {
|
delegate: Item {
|
||||||
x: 5
|
x: 5
|
||||||
width: 80
|
width: 80
|
||||||
height: 40
|
height: 40
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
text: GO.verseOrder(index)
|
text: go.verseOrder(index)
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
anchors.verticalCenter: parent.verticalCenter
|
||||||
font.bold: true
|
font.bold: true
|
||||||
}
|
}
|
||||||
@ -181,18 +183,18 @@ ApplicationWindow {
|
|||||||
id: fontPicker
|
id: fontPicker
|
||||||
objectName: "fontPicker"
|
objectName: "fontPicker"
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
model: GO.fontLen
|
model: go.fontLen
|
||||||
// @disable-check M16
|
// @disable-check M16
|
||||||
/*delegate:Text {
|
/*delegate:Text {
|
||||||
text: GO.fontList(index)
|
text: go.fontList(index)
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SpinBox {
|
SpinBox {
|
||||||
id: fontSize
|
id: fontSize
|
||||||
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
|
||||||
objectName: "fontSize"
|
objectName: "fontSize"
|
||||||
|
Layout.alignment: Qt.AlignLeft | Qt.AlignTop
|
||||||
maximumValue: 1000
|
maximumValue: 1000
|
||||||
value: 1
|
value: 1
|
||||||
suffix: "Pt"
|
suffix: "Pt"
|
||||||
@ -220,24 +222,25 @@ ApplicationWindow {
|
|||||||
ComboBox {
|
ComboBox {
|
||||||
id: versePicker
|
id: versePicker
|
||||||
objectName: "versePicker"
|
objectName: "versePicker"
|
||||||
model: GO.verseLen
|
model: go.verseLen
|
||||||
// @disable-check M16
|
// @disable-check M16
|
||||||
/* delegate: Text {
|
/* delegate: Text {
|
||||||
text: GO.verses(index)
|
text: go.verses(index)
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
|
|
||||||
ComboBox {
|
ComboBox {
|
||||||
id: imgPicker
|
id: imgPicker
|
||||||
objectName: "imgPicker"
|
objectName: "imgPicker"
|
||||||
model: GO.imgLen
|
model: go.imgLen
|
||||||
// @disable-check M16
|
// @disable-check M16
|
||||||
/*delegate: Text {
|
/*delegate: Text {
|
||||||
text: GO.img(index)
|
text: go.img(index)
|
||||||
}*/
|
}*/
|
||||||
}
|
}
|
||||||
TextArea {
|
TextArea {
|
||||||
id: textEdit1
|
id: txtVerse
|
||||||
|
objectName: "txtVerse"
|
||||||
width: 80
|
width: 80
|
||||||
height: 20
|
height: 20
|
||||||
text: qsTr("Text Edit")
|
text: qsTr("Text Edit")
|
||||||
|
Loading…
Reference in New Issue
Block a user