From bc809fb8db6c8486d31f15cc8bb74c8a53f5af2b Mon Sep 17 00:00:00 2001 From: lordwelch Date: Tue, 3 May 2016 10:25:23 -0700 Subject: [PATCH] start adding the songedit.qml for actuaal use --- imagick.go | 4 +++- main.go | 9 +++++---- qml.go | 8 +++++++- qml/cell.qml | 2 +- qml/songEdit.qml | 9 ++++++++- 5 files changed, 24 insertions(+), 8 deletions(-) diff --git a/imagick.go b/imagick.go index 6d4fb74..811e110 100644 --- a/imagick.go +++ b/imagick.go @@ -111,7 +111,9 @@ func (cl *cell) imgtext(width, height int) *imagick.MagickWand { r, g, b, _ := cl.font.color.RGBA() pw.SetColor(fmt.Sprintf("rgb(%d,%d,%d)", r, g, b)) dw.SetFillColor(pw) - dw.SetFont(cl.font.name) + if (cl.font.name != "") || (cl.font.name != "none") { + dw.SetFont(cl.font.name) + } dw.SetFontSize(cl.font.size) otlne := "none" diff --git a/main.go b/main.go index 6b7f9fe..021b04f 100644 --- a/main.go +++ b/main.go @@ -93,6 +93,7 @@ func run() error { window.Show() window2.Show() + edtQmlShow() slides[0].clearcache() qml.RunMain(glInit) @@ -126,14 +127,16 @@ func (sl *slide) add( /*cl *cell*/ ) { cl.qmlimg.Set("parent", window.ObjectByName("data2")) cl.qmlimg.Set("index", cl.index) cl.setSignal() + //give QML the text + cl.qmlcell.ObjectByName("cellText").Set("text", cl.text) } func (cl *cell) Init() { - cl.text = "Testing 1... 2... 3... :-P" + cl.text = "hello this is text\nhaha\nhdsjfklfhaskjd" cl.index = -1 cl.font.color, cl.font.outlineColor = color.RGBA{0, 0, 0, 1}, color.RGBA{1, 1, 1, 1} - cl.font.name = fontlst[1] + cl.font.name = "none" cl.font.outline = false cl.font.outlineSize = 1 cl.font.size = 35 @@ -146,8 +149,6 @@ func (cl *cell) Init() { cl.img = imagick.NewMagickWand() cl.img.ReadImage("logo:") - //give QML the text - cl.qmlcell.ObjectByName("cellText").Set("text", cl.text) } //(cell) remove() should destroy everything for this cell diff --git a/qml.go b/qml.go index a87e9e1..229e649 100644 --- a/qml.go +++ b/qml.go @@ -7,6 +7,7 @@ import ( "runtime/debug" "strconv" "strings" + "fmt" "github.com/lordwelch/qml" ) @@ -152,9 +153,14 @@ func setSignals() { } } }) - } +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 { if imgready && (len(id) > 0) { diff --git a/qml/cell.qml b/qml/cell.qml index bb60030..765e98b 100644 --- a/qml/cell.qml +++ b/qml/cell.qml @@ -13,7 +13,7 @@ Rectangle { id: cellText enabled: true objectName: "cellText" - text: "hello this is text\nhaha\nhdsjfklfhaskjd" + text: "" clip: true wrapMode: Text.WrapAtWordBoundaryOrAnywhere anchors.fill: parent diff --git a/qml/songEdit.qml b/qml/songEdit.qml index 7c35bd1..f7997a0 100644 --- a/qml/songEdit.qml +++ b/qml/songEdit.qml @@ -10,14 +10,18 @@ ApplicationWindow { ColorDialog { id: textClrDialog //objectname: "textClrDialog" + // @disable-check M16 title: "Please choose a color for the text" + // @disable-check M16 showAlphaChannel: true } ColorDialog { id: outlineClrDialog //objectname: "outlineClrDialog" + // @disable-check M16 title: "Please choose a color for the text" + // @disable-check M16 showAlphaChannel: true } @@ -205,8 +209,10 @@ ApplicationWindow { ComboBox { id: fontPicker - Layout.alignment: Qt.AlignLeft | Qt.AlignTop objectName: "fontPicker" + Layout.alignment: Qt.AlignLeft | Qt.AlignTop + model: ["test","test1","test2"] + } SpinBox { @@ -216,6 +222,7 @@ ApplicationWindow { maximumValue: 1000 value: 1 suffix: "Pt" + } SpinBox {