mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-14 05:05:53 +08:00
Merge pull request #2703 from fieldOfView/fix_setting_text_on_focus
Stop SettingTextField from setting values when getting/losing the focus
This commit is contained in:
commit
759c494aaa
@ -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
|
||||
@ -114,14 +122,24 @@ SettingItem
|
||||
}
|
||||
|
||||
Keys.onReleased:
|
||||
{
|
||||
if (text != textBeforeEdit)
|
||||
{
|
||||
textHasChanged = true;
|
||||
}
|
||||
if (textHasChanged)
|
||||
{
|
||||
propertyProvider.setPropertyValue("value", text)
|
||||
}
|
||||
}
|
||||
|
||||
onEditingFinished:
|
||||
{
|
||||
if (textHasChanged)
|
||||
{
|
||||
propertyProvider.setPropertyValue("value", text)
|
||||
}
|
||||
}
|
||||
|
||||
onActiveFocusChanged:
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user