Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'resources/qml/Settings/SettingTextField.qml')
-rw-r--r--resources/qml/Settings/SettingTextField.qml29
1 files changed, 20 insertions, 9 deletions
diff --git a/resources/qml/Settings/SettingTextField.qml b/resources/qml/Settings/SettingTextField.qml
index 95976ad58e..f0e3b2cacb 100644
--- a/resources/qml/Settings/SettingTextField.qml
+++ b/resources/qml/Settings/SettingTextField.qml
@@ -1,8 +1,8 @@
// Copyright (c) 2021 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.
-import QtQuick 2.7
-import QtQuick.Controls 2.0
+import QtQuick 2.15
+import QtQuick.Controls 2.15
import UM 1.5 as UM
@@ -32,11 +32,12 @@ SettingItem
anchors.fill: parent
+ borderColor: input.activeFocus ? UM.Theme.getColor("text_field_border_active") : "transparent"
liningColor:
{
if(!enabled)
{
- return UM.Theme.getColor("text_field_border_disabled")
+ return UM.Theme.getColor("text_field_border_disabled");
}
switch(propertyProvider.properties.validationState)
{
@@ -50,17 +51,21 @@ SettingItem
return UM.Theme.getColor("setting_validation_warning");
}
//Validation is OK.
- if(hovered || input.activeFocus)
+ if(input.activeFocus)
{
- return UM.Theme.getColor("text_field_border_hovered")
+ return UM.Theme.getColor("text_field_border_active");
}
- return UM.Theme.getColor("text_field_border")
+ if(hovered)
+ {
+ return UM.Theme.getColor("text_field_border_hovered");
+ }
+ return UM.Theme.getColor("text_field_border");
}
color: {
if(!enabled)
{
- return UM.Theme.getColor("text_field")
+ return UM.Theme.getColor("setting_control_disabled")
}
switch(propertyProvider.properties.validationState)
{
@@ -154,7 +159,7 @@ SettingItem
// should be done as little as possible)
clip: definition.type == "str" || definition.type == "[int]"
- validator: RegExpValidator { regExp: (definition.type == "[int]") ? /^\[?(\s*-?[0-9]{0,9}\s*,)*(\s*-?[0-9]{0,9})\s*\]?$/ : (definition.type == "int") ? /^-?[0-9]{0,10}$/ : (definition.type == "float") ? /^-?[0-9]{0,9}[.,]?[0-9]{0,3}$/ : /^.*$/ } // definition.type property from parent loader used to disallow fractional number entry
+ validator: RegularExpressionValidator { regularExpression: (definition.type == "[int]") ? /^\[?(\s*-?[0-9]{0,9}\s*,)*(\s*-?[0-9]{0,9})\s*\]?$/ : (definition.type == "int") ? /^-?[0-9]{0,10}$/ : (definition.type == "float") ? /^-?[0-9]{0,9}[.,]?[0-9]{0,3}$/ : /^.*$/ } // definition.type property from parent loader used to disallow fractional number entry
Binding
{
@@ -162,6 +167,13 @@ SettingItem
property: "text"
value:
{
+ if (input.activeFocus)
+ {
+ // In QT6 using "when: !activeFocus" causes the value to be null when activeFocus becomes True
+ // Since we want the value to stay the same when giving focus to the TextInput this is being used
+ // in place of "when: !activeFocus"
+ return input.text
+ }
// Stacklevels
// 0: user -> unsaved change
// 1: quality changes -> saved change
@@ -181,7 +193,6 @@ SettingItem
return propertyProvider.properties.value
}
}
- when: !input.activeFocus
}
MouseArea