mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-18 20:28:01 -06:00
Merge pull request #3496 from fieldOfView/fix_textfield_select
Only select all text when tabbing to fields, not when clicking a field
This commit is contained in:
commit
f3f4be5334
1 changed files with 24 additions and 9 deletions
|
@ -13,11 +13,17 @@ SettingItem
|
|||
|
||||
property string textBeforeEdit
|
||||
property bool textHasChanged
|
||||
property bool focusGainedByClick: false
|
||||
onFocusReceived:
|
||||
{
|
||||
textHasChanged = false;
|
||||
textBeforeEdit = focusItem.text;
|
||||
focusItem.selectAll();
|
||||
|
||||
if(!focusGainedByClick)
|
||||
{
|
||||
// select all text when tabbing through fields (but not when selecting a field with the mouse)
|
||||
focusItem.selectAll();
|
||||
}
|
||||
}
|
||||
|
||||
contents: Rectangle
|
||||
|
@ -93,14 +99,6 @@ SettingItem
|
|||
font: UM.Theme.getFont("default")
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
id: mouseArea
|
||||
anchors.fill: parent;
|
||||
//hoverEnabled: true;
|
||||
cursorShape: Qt.IBeamCursor
|
||||
}
|
||||
|
||||
TextInput
|
||||
{
|
||||
id: input
|
||||
|
@ -142,6 +140,7 @@ SettingItem
|
|||
{
|
||||
base.focusReceived();
|
||||
}
|
||||
base.focusGainedByClick = false;
|
||||
}
|
||||
|
||||
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
|
||||
|
@ -178,6 +177,22 @@ SettingItem
|
|||
}
|
||||
when: !input.activeFocus
|
||||
}
|
||||
|
||||
MouseArea
|
||||
{
|
||||
id: mouseArea
|
||||
anchors.fill: parent;
|
||||
|
||||
cursorShape: Qt.IBeamCursor
|
||||
|
||||
onPressed: {
|
||||
if(!input.activeFocus) {
|
||||
base.focusGainedByClick = true;
|
||||
input.forceActiveFocus();
|
||||
}
|
||||
mouse.accepted = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue