make text edit child of "col1" rectangle

This commit is contained in:
lordwelch 2016-03-09 10:43:28 -08:00
parent c7deef1a8b
commit 5f12adaa92
2 changed files with 55 additions and 54 deletions

View File

@ -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)

104
main.qml
View File

@ -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
}
}
}