mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-19 04:37:51 -06:00
Stop SettingTextField from setting values when getting/losing the focus
Fixes #2694
This commit is contained in:
parent
e6e61e9a3c
commit
8dfba9a318
1 changed files with 20 additions and 2 deletions
|
@ -11,6 +11,14 @@ SettingItem
|
|||
id: base
|
||||
property var focusItem: input
|
||||
|
||||
property string textBeforeEdit
|
||||
property bool textHasChanged
|
||||
onFocusReceived:
|
||||
{
|
||||
textHasChanged = false;
|
||||
textBeforeEdit = focusItem.text;
|
||||
}
|
||||
|
||||
contents: Rectangle
|
||||
{
|
||||
id: control
|
||||
|
@ -115,12 +123,22 @@ SettingItem
|
|||
|
||||
Keys.onReleased:
|
||||
{
|
||||
propertyProvider.setPropertyValue("value", text)
|
||||
if (text != textBeforeEdit)
|
||||
{
|
||||
textHasChanged = true;
|
||||
}
|
||||
if (textHasChanged)
|
||||
{
|
||||
propertyProvider.setPropertyValue("value", text)
|
||||
}
|
||||
}
|
||||
|
||||
onEditingFinished:
|
||||
{
|
||||
propertyProvider.setPropertyValue("value", text)
|
||||
if (textHasChanged)
|
||||
{
|
||||
propertyProvider.setPropertyValue("value", text)
|
||||
}
|
||||
}
|
||||
|
||||
onActiveFocusChanged:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue