From 5f12adaa923ba78a60a7feffed19bffae58e7348 Mon Sep 17 00:00:00 2001 From: lordwelch Date: Wed, 9 Mar 2016 10:43:28 -0800 Subject: [PATCH] make text edit child of "col1" rectangle --- main.go | 5 +-- main.qml | 104 +++++++++++++++++++++++++++---------------------------- 2 files changed, 55 insertions(+), 54 deletions(-) diff --git a/main.go b/main.go index f5ffbf4..2251c9a 100644 --- a/main.go +++ b/main.go @@ -285,10 +285,11 @@ func (cl *cell) setSignal() { cl.qmlcell.ObjectByName("cellMouse").On("doubleClicked", func() { textEdit.Set("cell", cl.index) - textEdit.Set("x", cl.qmlcell.Int("x")+4) - textEdit.Set("y", cl.qmlcell.Int("y")+4) + textEdit.Set("x", cl.qmlcell.Int("x")) + textEdit.Set("y", cl.qmlcell.Int("y")) textEdit.Set("width", cl.qmlcell.Int("width")) textEdit.Set("height", cl.qmlcell.Int("height")) + textEdit.Set("z", 100) textEdit.Set("opacity", 100) textEdit.Set("visible", true) textEdit.ObjectByName("textEdit1").Set("focus", true) diff --git a/main.qml b/main.qml index 154ca38..97cbda5 100644 --- a/main.qml +++ b/main.qml @@ -94,6 +94,58 @@ ApplicationWindow { color: "#e41616" transformOrigin: Item.TopLeft border.width: 0 + Rectangle { + id: textEdit + property int cell + x: 232 + y: 622 + objectName: "textEdit" + width: 200 + height: 200 + color: "#ffffff" + visible: false + property bool txt: true + Keys.onPressed: { + if ((event.key == Qt.Key_Return) + && (event.modifiers & Qt.ControlModifier)) { + txt = true + + x = -100 + y = -100 + visible = false + focus = true + enabled = false + opacity = 0 + textEdit1.focus = false + + event.accepted = true + } + + if (event.key == Qt.Key_Escape) { + txt = false + x = -100 + y = -100 + visible = false + focus = true + enabled = false + opacity = 0 + textEdit1.focus = false + + event.accepted = true + } + } + + TextArea { + id: textEdit1 + objectName: "textEdit1" + anchors.fill: parent + clip: true + textFormat: Text.AutoText + visible: true + font.pixelSize: 12 + z: 99 + } + } Column { id: data1 @@ -149,56 +201,4 @@ ApplicationWindow { } } - Rectangle { - id: textEdit - property int cell - x: 232 - y: 622 - objectName: "textEdit" - width: 200 - height: 200 - color: "#ffffff" - visible: false - property bool txt: true - Keys.onPressed: { - if ((event.key == Qt.Key_Return) - && (event.modifiers & Qt.ControlModifier)) { - txt = true - - x = -100 - y = -100 - visible = false - focus = true - enabled = false - opacity = 0 - textEdit1.focus = false - - event.accepted = true - } - - if (event.key == Qt.Key_Escape) { - txt = false - x = -100 - y = -100 - visible = false - focus = true - enabled = false - opacity = 0 - textEdit1.focus = false - - event.accepted = true - } - } - - TextArea { - id: textEdit1 - objectName: "textEdit1" - anchors.fill: parent - clip: true - textFormat: Text.AutoText - visible: true - font.pixelSize: 12 - z: 99 - } - } }