From 949c3800188a40e09f20863ab9be2c545eec791d Mon Sep 17 00:00:00 2001 From: Henning Gruendl Date: Thu, 27 Apr 2023 14:01:38 +0200 Subject: [PATCH] QmlDesigner: Fix TextFieldSpecifics Add TextInputSection to TextFieldSpecifics as TextField inherits from TextInput. Align the properties of the contained sections to the ones in TextInputSpecifics. Also adjust TextArea specifics to also contain TextInputSection. Task-number: QDS-9792 Change-Id: I3a4a734d965f3834ccd1e5cad23bb125b9ca592c Reviewed-by: Thomas Hartmann Reviewed-by: --- .../QtQuick/Controls/TextAreaSpecifics.qml | 2 ++ .../QtQuick/Controls/TextFieldSpecifics.qml | 16 +++++++-- .../HelperWidgets}/TextInputSection.qml | 36 +++++++++---------- .../imports/HelperWidgets/qmldir | 1 + 4 files changed, 34 insertions(+), 21 deletions(-) rename share/qtcreator/qmldesigner/propertyEditorQmlSources/{QtQuick => imports/HelperWidgets}/TextInputSection.qml (89%) diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/TextAreaSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/TextAreaSpecifics.qml index 766e2b78aa5..d6b0c76c57e 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/TextAreaSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/TextAreaSpecifics.qml @@ -16,6 +16,8 @@ Column { showVerticalAlignment: true } + TextInputSection {} + TextExtrasSection { showWrapMode: true showFormatProperty: true diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/TextFieldSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/TextFieldSpecifics.qml index d7286272309..b0aa6fbfc59 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/TextFieldSpecifics.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/Controls/TextFieldSpecifics.qml @@ -14,11 +14,21 @@ Column { caption: qsTr("Text Field") } - CharacterSection {} + CharacterSection { + showVerticalAlignment: true + } - TextExtrasSection {} + TextInputSection { + isTextInput: true + } - FontExtrasSection {} + TextExtrasSection { + showWrapMode: true + } + + FontExtrasSection { + showStyle: false + } PaddingSection {} diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/TextInputSection.qml similarity index 89% rename from share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml rename to share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/TextInputSection.qml index b76666f7bc5..737c742b33e 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/TextInputSection.qml @@ -7,7 +7,7 @@ import HelperWidgets 2.0 import StudioTheme 1.0 as StudioTheme Section { - id: textInputSection + id: root anchors.left: parent.left anchors.right: parent.right caption: qsTr("Text Input") @@ -46,7 +46,7 @@ Section { + StudioTheme.Values.actionIndicatorWidth width: implicitWidth backendValue: backendValues.mouseSelectionMode - scope: "TextInput" + scope: root.isTextInput ? "TextInput" : "TextEdit" model: ["SelectCharacters", "SelectWords"] } @@ -54,13 +54,13 @@ Section { } PropertyLabel { - visible: textInputSection.isTextInput + visible: root.isTextInput text: qsTr("Input mask") tooltip: qsTr("Sets the allowed characters.") } SecondColumnLayout { - visible: textInputSection.isTextInput + visible: root.isTextInput LineEdit { backendValue: backendValues.inputMask @@ -74,13 +74,13 @@ Section { } PropertyLabel { - visible: textInputSection.isTextInput + visible: root.isTextInput text: qsTr("Echo mode") tooltip: qsTr("Sets the visibility mode.") } SecondColumnLayout { - visible: textInputSection.isTextInput + visible: root.isTextInput ComboBox { implicitWidth: StudioTheme.Values.singleControlColumnWidth @@ -95,13 +95,13 @@ Section { } PropertyLabel { - visible: textInputSection.isTextInput + visible: root.isTextInput text: qsTr("Password character") tooltip: qsTr("Sets which character to display when passwords are entered.") } SecondColumnLayout { - visible: textInputSection.isTextInput + visible: root.isTextInput LineEdit { backendValue: backendValues.passwordCharacter @@ -115,13 +115,13 @@ Section { } PropertyLabel { - visible: !textInputSection.isTextInput + visible: !root.isTextInput text: qsTr("Tab stop distance") tooltip: qsTr("Default distance between tab stops in device units.") } SecondColumnLayout { - visible: !textInputSection.isTextInput + visible: !root.isTextInput SpinBox { implicitWidth: StudioTheme.Values.twoControlColumnWidth @@ -139,13 +139,13 @@ Section { } PropertyLabel { - visible: !textInputSection.isTextInput + visible: !root.isTextInput text: qsTr("Text margin") tooltip: qsTr("Margin around the text in the Text Edit in pixels.") } SecondColumnLayout { - visible: !textInputSection.isTextInput + visible: !root.isTextInput SpinBox { implicitWidth: StudioTheme.Values.twoControlColumnWidth @@ -163,13 +163,13 @@ Section { } PropertyLabel { - visible: textInputSection.isTextInput + visible: root.isTextInput text: qsTr("Maximum length") tooltip: qsTr("Sets the maximum length of the text.") } SecondColumnLayout { - visible: textInputSection.isTextInput + visible: root.isTextInput SpinBox { implicitWidth: StudioTheme.Values.singleControlColumnWidth @@ -216,13 +216,13 @@ Section { FlagItem { backendValue: backendValues.activeFocusOnPress } PropertyLabel { - visible: textInputSection.isTextInput + visible: root.isTextInput text: qsTr("Auto scroll") tooltip: qsTr("Toggles if the text scrolls when it exceeds its boundary.") } FlagItem { - visible: textInputSection.isTextInput + visible: root.isTextInput backendValue: backendValues.autoScroll } @@ -248,12 +248,12 @@ Section { FlagItem { backendValue: backendValues.selectByMouse } PropertyLabel { - visible: !textInputSection.isTextInput + visible: !root.isTextInput text: qsTr("Select by keyboard") } FlagItem { - visible: !textInputSection.isTextInput + visible: !root.isTextInput backendValue: backendValues.selectByKeyboard } } diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir index ca1411a4d6e..9c19a45e2ef 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/qmldir @@ -67,6 +67,7 @@ Spacer 2.0 Spacer.qml SpinBox 2.0 SpinBox.qml StandardTextSection 2.0 StandardTextSection.qml TextExtrasSection 2.0 TextExtrasSection.qml +TextInputSection 2.0 TextInputSection.qml ToolTipArea 2.0 ToolTipArea.qml UrlChooser 2.0 UrlChooser.qml VerticalScrollBar 2.0 VerticalScrollBar.qml