mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-08 07:27:29 -06:00
Only select all text when tabbing through fields, not when clicking a field
This commit is contained in:
parent
4a9fc4b7d4
commit
2703474861
1 changed files with 24 additions and 9 deletions
|
@ -13,11 +13,17 @@ SettingItem
|
||||||
|
|
||||||
property string textBeforeEdit
|
property string textBeforeEdit
|
||||||
property bool textHasChanged
|
property bool textHasChanged
|
||||||
|
property bool focusGainedByClick: false
|
||||||
onFocusReceived:
|
onFocusReceived:
|
||||||
{
|
{
|
||||||
textHasChanged = false;
|
textHasChanged = false;
|
||||||
textBeforeEdit = focusItem.text;
|
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
|
contents: Rectangle
|
||||||
|
@ -92,14 +98,6 @@ SettingItem
|
||||||
font: UM.Theme.getFont("default")
|
font: UM.Theme.getFont("default")
|
||||||
}
|
}
|
||||||
|
|
||||||
MouseArea
|
|
||||||
{
|
|
||||||
id: mouseArea
|
|
||||||
anchors.fill: parent;
|
|
||||||
//hoverEnabled: true;
|
|
||||||
cursorShape: Qt.IBeamCursor
|
|
||||||
}
|
|
||||||
|
|
||||||
TextInput
|
TextInput
|
||||||
{
|
{
|
||||||
id: input
|
id: input
|
||||||
|
@ -141,6 +139,7 @@ SettingItem
|
||||||
{
|
{
|
||||||
base.focusReceived();
|
base.focusReceived();
|
||||||
}
|
}
|
||||||
|
base.focusGainedByClick = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
|
color: !enabled ? UM.Theme.getColor("setting_control_disabled_text") : UM.Theme.getColor("setting_control_text")
|
||||||
|
@ -177,6 +176,22 @@ SettingItem
|
||||||
}
|
}
|
||||||
when: !input.activeFocus
|
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