summaryrefslogtreecommitdiff
path: root/share/qtcreator/qmldesigner/itemLibraryQmlSources
diff options
context:
space:
mode:
authorAmr Essam <amr.elsayed@qt.io>2023-01-20 14:54:36 +0200
committerAmr Elsayed <amr.elsayed@qt.io>2023-01-20 15:00:53 +0000
commit18f9ddc9604f5d65f5f27a386eff095bdf7f65c4 (patch)
tree8e9512b042e2e3ce3b445f10affc387b7ace3da5 /share/qtcreator/qmldesigner/itemLibraryQmlSources
parent27925d5bc5b847c377cb3e90447070ca23b132b1 (diff)
downloadqt-creator-18f9ddc9604f5d65f5f27a386eff095bdf7f65c4.tar.gz
QmlDesigner: fix user cannot name new effects properly
Task-number: QDS-8705 Change-Id: Idef4a40efdc2bdf052e1f6daef5abe16d27bce99 Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'share/qtcreator/qmldesigner/itemLibraryQmlSources')
-rw-r--r--share/qtcreator/qmldesigner/itemLibraryQmlSources/NewEffectDialog.qml22
1 files changed, 16 insertions, 6 deletions
diff --git a/share/qtcreator/qmldesigner/itemLibraryQmlSources/NewEffectDialog.qml b/share/qtcreator/qmldesigner/itemLibraryQmlSources/NewEffectDialog.qml
index f57284e678..0c6f77154b 100644
--- a/share/qtcreator/qmldesigner/itemLibraryQmlSources/NewEffectDialog.qml
+++ b/share/qtcreator/qmldesigner/itemLibraryQmlSources/NewEffectDialog.qml
@@ -18,11 +18,6 @@ Dialog {
required property string dirPath
readonly property int __maxPath: 32
- HelperWidgets.RegExpValidator {
- id: effectNameValidator
- regExp: /^[A-Z]\w[A-Za-z0-9_]*$/
- }
-
ErrorDialog {
id: creationFailedDialog
title: qsTr("Could not create effect")
@@ -44,10 +39,14 @@ Dialog {
actionIndicator.visible: false
translationIndicator.visible: false
- validator: effectNameValidator
Keys.onEnterPressed: btnCreate.onClicked()
Keys.onReturnPressed: btnCreate.onClicked()
+ onTextChanged: {
+ let validator = /^[A-Z]\w{2,}[A-Za-z0-9_]*$/
+ txtNameValidatorMsg.visible = text.length > 0 && !validator.test(text)
+ btnCreate.enabled = !txtNameValidatorMsg.visible
+ }
}
}
@@ -65,6 +64,17 @@ Dialog {
visible: effectName.text.length > root.__maxPath
}
+ Text {
+ id: txtNameValidatorMsg
+ text: qsTr('The name must start with a capital letter, ' +
+ 'contain at least three characters, ' +
+ 'and cannot have any special characters.')
+ color: "#ff0000"
+ anchors.right: parent.right
+ anchors.left: parent.left
+ wrapMode: "WordWrap"
+ }
+
Item { // spacer
width: 1
height: 20