mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 17:39:03 +08:00
Stop SettingTextField from setting values when getting/losing the focus
Fixes #2694
This commit is contained in:
parent
e6e61e9a3c
commit
8dfba9a318
@ -11,6 +11,14 @@ SettingItem
|
|||||||
id: base
|
id: base
|
||||||
property var focusItem: input
|
property var focusItem: input
|
||||||
|
|
||||||
|
property string textBeforeEdit
|
||||||
|
property bool textHasChanged
|
||||||
|
onFocusReceived:
|
||||||
|
{
|
||||||
|
textHasChanged = false;
|
||||||
|
textBeforeEdit = focusItem.text;
|
||||||
|
}
|
||||||
|
|
||||||
contents: Rectangle
|
contents: Rectangle
|
||||||
{
|
{
|
||||||
id: control
|
id: control
|
||||||
@ -114,14 +122,24 @@ SettingItem
|
|||||||
}
|
}
|
||||||
|
|
||||||
Keys.onReleased:
|
Keys.onReleased:
|
||||||
|
{
|
||||||
|
if (text != textBeforeEdit)
|
||||||
|
{
|
||||||
|
textHasChanged = true;
|
||||||
|
}
|
||||||
|
if (textHasChanged)
|
||||||
{
|
{
|
||||||
propertyProvider.setPropertyValue("value", text)
|
propertyProvider.setPropertyValue("value", text)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onEditingFinished:
|
onEditingFinished:
|
||||||
|
{
|
||||||
|
if (textHasChanged)
|
||||||
{
|
{
|
||||||
propertyProvider.setPropertyValue("value", text)
|
propertyProvider.setPropertyValue("value", text)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onActiveFocusChanged:
|
onActiveFocusChanged:
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user