Commit 08917bb2 authored by Christiaan Janssen's avatar Christiaan Janssen
Browse files

QmlDesigner.StatesEditor: TextInput area fits the whole containing box

parent ddf6e93d
...@@ -197,24 +197,25 @@ Rectangle { ...@@ -197,24 +197,25 @@ Rectangle {
id: txt id: txt
text: stateName text: stateName
color: "#E1E1E1"; color: "#E1E1E1";
MouseRegion { }
id: txtRegion MouseRegion {
anchors.fill:parent id: txtRegion
onClicked: { anchors.fill:parent
if (root.currentStateIndex != index) onClicked: {
root.unFocus(); if (root.currentStateIndex != index)
root.currentStateIndex = index; root.unFocus();
root.currentStateIndex = index;
} }
onDoubleClicked: if (index!=0) { onDoubleClicked: if (index!=0) {
stateNameInput.text=stateName; stateNameInput.text=stateName;
stateNameInput.focus=true; stateNameInput.focus=true;
stateNameEditor.visible=true; stateNameEditor.visible=true;
stateNameInput.cursorVisible=true; stateNameInput.cursorVisible=true;
}
} }
} }
Rectangle { Rectangle {
id:stateNameEditor id:stateNameEditor
visible:false visible:false
...@@ -222,7 +223,7 @@ Rectangle { ...@@ -222,7 +223,7 @@ Rectangle {
x:2 x:2
y:2 y:2
height:parent.height height:parent.height
width:Math.max(img.width,txt.width+removeState.width+2,stateNameInput.width+16) width:Math.max(img.width,txt.width+removeState.width+2,transparentText.width+16)
clip:true clip:true
color:"white" color:"white"
...@@ -239,10 +240,16 @@ Rectangle { ...@@ -239,10 +240,16 @@ Rectangle {
id: AbsorbAllClicks id: AbsorbAllClicks
anchors.fill:parent anchors.fill:parent
} }
Text {
text:stateNameInput.text
visible:false
id:transparentText
}
TextInput { TextInput {
id:stateNameInput id:stateNameInput
x:10
text:stateName text:stateName
anchors.fill:parent
anchors.leftMargin:8
onAccepted: { onAccepted: {
statesEditorModel.renameState(index,text); statesEditorModel.renameState(index,text);
parent.visible=false; parent.visible=false;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment