From a965b6630f4ecefae4ec367a5c71fb4910153c76 Mon Sep 17 00:00:00 2001 From: Aleksei German Date: Tue, 11 Jun 2024 16:07:18 +0200 Subject: [PATCH] QmlDesigner: Enable TextInput item for MCUs config MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Task-number: QDS-12608 Change-Id: I5dab267b9d2e48d1c6ae1552d26ea9dab99ee424 Reviewed-by: Henning Gründl (cherry picked from commit 1600a169cdf8a03d42e64b22e64b14d18ea7246e) Reviewed-by: Thomas Hartmann --- .../HelperWidgets/TextInputSection.qml | 66 ++++- .../qtcreator/qmldesigner/qt4mcu/metadata.qml | 8 +- share/qtcreator/qmldesigner/qt4mcu/qul-28.qml | 237 ++++++++++++++++++ 3 files changed, 304 insertions(+), 7 deletions(-) create mode 100644 share/qtcreator/qmldesigner/qt4mcu/qul-28.qml diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/TextInputSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/TextInputSection.qml index 737c742b33e..5a00babb353 100644 --- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/TextInputSection.qml +++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/TextInputSection.qml @@ -14,30 +14,42 @@ Section { property bool isTextInput: false + function isBackendValueAvailable(name) { + if (backendValues[name] !== undefined) + return backendValues[name].isAvailable + + return false + } + SectionLayout { PropertyLabel { text: qsTr("Selection color") tooltip: qsTr("Sets the background color of selected text.") + blockedByTemplate: !root.isBackendValueAvailable("selectionColor") } ColorEditor { backendValue: backendValues.selectionColor supportGradient: false + enabled: root.isBackendValueAvailable("selectionColor") } PropertyLabel { text: qsTr("Selected text color") tooltip: qsTr("Sets the color of selected text.") + blockedByTemplate: !root.isBackendValueAvailable("selectedTextColor") } ColorEditor { backendValue: backendValues.selectedTextColor supportGradient: false + enabled: root.isBackendValueAvailable("selectedTextColor") } PropertyLabel { text: qsTr("Selection mode") tooltip: qsTr("Sets the way text is selected with the mouse.") + blockedByTemplate: !root.isBackendValueAvailable("mouseSelectionMode") } SecondColumnLayout { @@ -48,6 +60,7 @@ Section { backendValue: backendValues.mouseSelectionMode scope: root.isTextInput ? "TextInput" : "TextEdit" model: ["SelectCharacters", "SelectWords"] + enabled: root.isBackendValueAvailable("mouseSelectionMode") } ExpandingSpacer {} @@ -57,6 +70,7 @@ Section { visible: root.isTextInput text: qsTr("Input mask") tooltip: qsTr("Sets the allowed characters.") + blockedByTemplate: !root.isBackendValueAvailable("inputMask") } SecondColumnLayout { @@ -68,6 +82,7 @@ Section { + StudioTheme.Values.actionIndicatorWidth width: implicitWidth showTranslateCheckBox: false + enabled: root.isBackendValueAvailable("inputMask") } ExpandingSpacer {} @@ -77,6 +92,7 @@ Section { visible: root.isTextInput text: qsTr("Echo mode") tooltip: qsTr("Sets the visibility mode.") + blockedByTemplate: !root.isBackendValueAvailable("echoMode") } SecondColumnLayout { @@ -89,6 +105,7 @@ Section { backendValue: backendValues.echoMode scope: "TextInput" model: ["Normal", "Password", "PasswordEchoOnEdit", "NoEcho"] + enabled: root.isBackendValueAvailable("echoMode") } ExpandingSpacer {} @@ -98,6 +115,7 @@ Section { visible: root.isTextInput text: qsTr("Password character") tooltip: qsTr("Sets which character to display when passwords are entered.") + blockedByTemplate: !root.isBackendValueAvailable("passwordCharacter") } SecondColumnLayout { @@ -109,6 +127,7 @@ Section { + StudioTheme.Values.actionIndicatorWidth width: implicitWidth showTranslateCheckBox: false + enabled: root.isBackendValueAvailable("passwordCharacter") } ExpandingSpacer {} @@ -118,6 +137,7 @@ Section { visible: !root.isTextInput text: qsTr("Tab stop distance") tooltip: qsTr("Default distance between tab stops in device units.") + blockedByTemplate: !root.isBackendValueAvailable("tabStopDistance") } SecondColumnLayout { @@ -129,6 +149,7 @@ Section { backendValue: backendValues.tabStopDistance maximumValue: 200 minimumValue: 0 + enabled: root.isBackendValueAvailable("tabStopDistance") } Spacer { implicitWidth: StudioTheme.Values.controlLabelGap } @@ -142,6 +163,7 @@ Section { visible: !root.isTextInput text: qsTr("Text margin") tooltip: qsTr("Margin around the text in the Text Edit in pixels.") + blockedByTemplate: !root.isBackendValueAvailable("textMargin") } SecondColumnLayout { @@ -153,6 +175,7 @@ Section { backendValue: backendValues.textMargin maximumValue: 200 minimumValue: -200 + enabled: root.isBackendValueAvailable("textMargin") } Spacer { implicitWidth: StudioTheme.Values.controlLabelGap } @@ -166,6 +189,7 @@ Section { visible: root.isTextInput text: qsTr("Maximum length") tooltip: qsTr("Sets the maximum length of the text.") + blockedByTemplate: !root.isBackendValueAvailable("maximumLength") } SecondColumnLayout { @@ -177,6 +201,7 @@ Section { backendValue: backendValues.maximumLength minimumValue: 0 maximumValue: 32767 + enabled: root.isBackendValueAvailable("maximumLength") } ExpandingSpacer {} @@ -184,6 +209,7 @@ Section { component FlagItem : SecondColumnLayout { property alias backendValue: checkBox.backendValue + CheckBox { id: checkBox implicitWidth: StudioTheme.Values.twoControlColumnWidth @@ -197,64 +223,92 @@ Section { PropertyLabel { text: qsTr("Read only") tooltip: qsTr("Toggles if the text allows edits.") + blockedByTemplate: !root.isBackendValueAvailable("readOnly") } - FlagItem { backendValue: backendValues.readOnly } + FlagItem { + backendValue: backendValues.readOnly + enabled: root.isBackendValueAvailable("readOnly") + } PropertyLabel { text: qsTr("Cursor visible") tooltip: qsTr("Toggles if the cursor is visible.") + blockedByTemplate: !root.isBackendValueAvailable("cursorVisible") } - FlagItem { backendValue: backendValues.cursorVisible } + FlagItem { + backendValue: backendValues.cursorVisible + enabled: root.isBackendValueAvailable("cursorVisible") + } PropertyLabel { text: qsTr("Focus on press") tooltip: qsTr("Toggles if the text is focused on mouse click.") + blockedByTemplate: !root.isBackendValueAvailable("activeFocusOnPress") } - FlagItem { backendValue: backendValues.activeFocusOnPress } + FlagItem { + backendValue: backendValues.activeFocusOnPress + enabled: root.isBackendValueAvailable("activeFocusOnPress") + } PropertyLabel { visible: root.isTextInput text: qsTr("Auto scroll") tooltip: qsTr("Toggles if the text scrolls when it exceeds its boundary.") + blockedByTemplate: !root.isBackendValueAvailable("autoScroll") } FlagItem { visible: root.isTextInput backendValue: backendValues.autoScroll + enabled: root.isBackendValueAvailable("autoScroll") } PropertyLabel { text: qsTr("Overwrite mode") tooltip: qsTr("Toggles if overwriting text is allowed.") + blockedByTemplate: !root.isBackendValueAvailable("overwriteMode") } - FlagItem { backendValue: backendValues.overwriteMode } + FlagItem { + backendValue: backendValues.overwriteMode + enabled: root.isBackendValueAvailable("overwriteMode") + } PropertyLabel { text: qsTr("Persistent selection") tooltip: qsTr("Toggles if the text should remain selected after moving the focus elsewhere.") + blockedByTemplate: !root.isBackendValueAvailable("persistentSelection") } - FlagItem { backendValue: backendValues.persistentSelection } + FlagItem { + backendValue: backendValues.persistentSelection + enabled: root.isBackendValueAvailable("persistentSelection") + } PropertyLabel { text: qsTr("Select by mouse") tooltip: qsTr("Toggles if the text can be selected with the mouse.") + blockedByTemplate: !root.isBackendValueAvailable("selectByMouse") } - FlagItem { backendValue: backendValues.selectByMouse } + FlagItem { + backendValue: backendValues.selectByMouse + enabled: root.isBackendValueAvailable("selectByMouse") + } PropertyLabel { visible: !root.isTextInput text: qsTr("Select by keyboard") + blockedByTemplate: !root.isBackendValueAvailable("selectByKeyboard") } FlagItem { visible: !root.isTextInput backendValue: backendValues.selectByKeyboard + enabled: root.isBackendValueAvailable("selectByKeyboard") } } } diff --git a/share/qtcreator/qmldesigner/qt4mcu/metadata.qml b/share/qtcreator/qmldesigner/qt4mcu/metadata.qml index 2df700e72ac..59193147814 100644 --- a/share/qtcreator/qmldesigner/qt4mcu/metadata.qml +++ b/share/qtcreator/qmldesigner/qt4mcu/metadata.qml @@ -5,7 +5,7 @@ Metadata { id: metadataFile - defaultVersion: v27 + defaultVersion: v28 VersionData { id: v14 @@ -78,4 +78,10 @@ Metadata { name: "Qt for MCUs 2.7" path: "qul-27.qml" } + + VersionData { + id: v28 + name: "Qt for MCUs 2.8" + path: "qul-28.qml" + } } diff --git a/share/qtcreator/qmldesigner/qt4mcu/qul-28.qml b/share/qtcreator/qmldesigner/qt4mcu/qul-28.qml new file mode 100644 index 00000000000..00e79dce53a --- /dev/null +++ b/share/qtcreator/qmldesigner/qt4mcu/qul-28.qml @@ -0,0 +1,237 @@ +// Copyright (C) 2023 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0 + +// new import: QtQuick.Layout +// new types: TextInput, Layouts + +VersionData { + name: "Qt for MCUs 2.8" + + bannedItems: [ + "QtQuick.AnimatedImage", + "QtQuick.Flow", + "QtQuick.FocusScope", + "QtQuick.Grid", + "QtQuick.GridView", + "QtQuick.PathView", + "QtQuick.TextEdit", + "QtQuick.Controls", + "QtQuick.Controls.BusyIndicator", + "QtQuick.Controls.ButtonGroup", + "QtQuick.Controls.CheckDelegate", + "QtQuick.Controls.ComboBox", + "QtQuick.Controls.Container", + "QtQuick.Controls.DelayButton", + "QtQuick.Controls.Frame", + "QtQuick.Controls.GroupBox", + "QtQuick.Controls.ItemDelegate", + "QtQuick.Controls.Label", + "QtQuick.Controls.Page", + "QtQuick.Controls.PageIndicator", + "QtQuick.Controls.Pane", + "QtQuick.Controls.RadioDelegate", + "QtQuick.Controls.RangeSlider", + "QtQuick.Controls.RoundButton", + "QtQuick.Controls.ScrollView", + "QtQuick.Controls.SpinBox", + "QtQuick.Controls.StackView", + "QtQuick.Controls.SwipeDelegate", + "QtQuick.Controls.SwitchDelegate", + "QtQuick.Controls.TabBar", + "QtQuick.Controls.TabButton", + "QtQuick.Controls.TextArea", + "QtQuick.Controls.TextField", + "QtQuick.Controls.ToolBar", + "QtQuick.Controls.ToolButton", + "QtQuick.Controls.ToolSeparator", + "QtQuick.Controls.Tumbler", + "QtQuick.Shapes.ConicalGradient", + "QtQuick.Shapes.RadialGradient" + ] + + allowedImports: [ + "QtQuick", + "QtQuick.Controls", + "QtQuick.Shapes", + "QtQuick.Timeline", + "QtQuickUltralite.Extras", + "QtQuickUltralite.Layers", + "QtQuickUltralite.Profiling", + "QtQuickUltralite.Studio.Components" + ] + + bannedImports: [ + "FlowView", + "SimulinkConnector" + ] + + //ComplexProperty is not a type, it's just a way to handle bigger props + ComplexProperty { + prefix: "font" + bannedProperties: ["wordSpacing", "letterSpacing", "hintingPreference", + "kerning", "preferShaping", "capitalization", + "strikeout", "underline", "styleName"] + } + + QtQml.Timer { + bannedProperties: ["triggeredOnStart"] + } + + QtQuick.Item { + bannedProperties: ["layer", "opacity", "smooth", "antialiasing", + "baselineOffset", "focus", "activeFocusOnTab", + "rotation", "scale", "transformOrigin"] + } + + QtQuick.Rectangle { + bannedProperties: ["border"] + } + + QtQuick.Flickable { + bannedProperties: ["boundsMovement", "flickDeceleration", + "leftMargin", "rightMargin", "bottomMargin", "topMargin", + "originX", "originY", "pixelAligned", "pressDelay", "synchronousDrag"] + } + + QtQuick.MouseArea { + bannedProperties: ["propagateComposedEvents", "preventStealing", "cursorShape", + "scrollGestureEnabled", "drag", "acceptedButtons", "hoverEnabled"] + } + + QtQuick.Image { + allowChildren: false + allowedProperties: ["rotation", "scale", "transformOrigin"] + bannedProperties: ["mirror", "mipmap", "cache", "autoTransform", "asynchronous", + "sourceSize", "smooth"] + } + + QtQuick.BorderImage { + bannedProperties: ["asynchronous", "cache", "currentFrame", "frameCount", + "horizontalTileMode", "mirror", "progress", "smooth", "sourceSize", + "status", "verticalTileMode"] + } + + QtQuick.Text { + allowChildren: false + allowedProperties: ["rotation", "scale", "transformOrigin"] + bannedProperties: ["lineHeight", "lineHeightMode", "style", + "styleColor", "minimumPointSize", "minimumPixelSize", + "fontSizeMode", "renderType", "renderTypeQuality", "maximumLineCount"] + } + + QtQuick.TextInput { + bannedProperties: ["acceptableInput", "autoScroll", "bottomPadding", "canPaste", + "canRedo", "canUndo", "contentHeight", "contentWidth", "cursorDelegate", + "cursorPosition", "cursorRectangle", "cursorVisible", "displayText", "echoMode", + "effectiveHorizontalAlignment", "horizontalAlignment", "inputMask", + "inputMethodComposing", "leftPadding", "length", "maximumLength", + "mouseSelectionMode", "overwriteMode", "padding", "passwordCharacter", + "passwordMaskDelay", "persistentSelection", "preeditText", "readOnly", + "renderType", "rightPadding", "selectByMouse", "selectedText", + "selectedTextColor", "selectionColor", "selectionEnd", "selectionStart", + "topPadding", "validator", "verticalAlignment", "wrapMode"] + } + + QtQuick.Loader { + bannedProperties: ["asynchronous", "progress", "status"] + } + + //Padding is not an actual item, but rather set of properties in Text + Padding { + bannedProperties: ["bottomPadding", "topPadding", "leftPadding", "rightPadding"] + } + + QtQuick.Column { + bannedProperties: ["bottomPadding", "leftPadding", "rightPadding", "topPadding"] + } + + QtQuick.Row { + bannedProperties: ["bottomPadding", "leftPadding", "rightPadding", "topPadding", + "effectiveLayoutDirection", "layoutDirection"] + } + + QtQuick.ListView { + bannedProperties: ["cacheBuffer", "highlightRangeMode", "highlightMoveDuration", + "highlightResizeDuration", "preferredHighlightBegin", "layoutDirection", + "preferredHighlightEnd", "highlightFollowsCurrentItem", "keyNavigationWraps", + "snapMode", "highlightMoveVelocity", "highlightResizeVelocity"] + } + + QtQuick.Animation { + bannedProperties: ["paused"] + } + + QtQuick.AnimatedSprite { + allowedProperties: ["currentFrame", "frameCount", "paused"] + bannedProperties: ["finishBehavior", "frameRate", "frameSync", + "frameX", "frameY", "interpolate", "reverse"] + } + + //Quick Controls2 Items and properties: + + QtQuick.Controls.Control { + bannedProperties: ["focusPolicy", "hoverEnabled", "wheelEnabled"] + } + + QtQuick.Controls.AbstractButton { + bannedProperties: ["display", "autoExclusive", "icon"] + } + + QtQuick.Controls.ProgressBar { + bannedProperties: ["indeterminate"] + } + + QtQuick.Controls.Slider { + bannedProperties: ["live", "snapMode", "touchDragThreshold"] + } + + //Path and Shapes related: + + QtQuick.Path { + bannedProperties: ["scale", "pathElements"] + } + + QtQuick.PathArc { + bannedProperties: ["relativeX", "relativeY"] + } + + QtQuick.PathLine { + bannedProperties: ["relativeX", "relativeY"] + } + + QtQuick.PathMove { + bannedProperties: ["relativeX", "relativeY"] + } + + QtQuick.PathQuad { + bannedProperties: ["relativeX", "relativeY", + "relativeControlX", "relativeControlY"] + } + + QtQuick.PathCubic { + bannedProperties: ["relativeX", "relativeY", + "relativeControl1X", "relativeControl1Y", + "relativeControl2X", "relativeControl2Y"] + } + + QtQuick.PathElement { + //nothing + } + + QtQuick.PathSvg { + //nothing + } + + QtQuick.Shapes.Shape { + bannedProperties: ["asynchronous", "containsMode", "data", + "renderType", "status", "vendorExtensionsEnabled"] + } + + QtQuick.Shapes.ShapePath { + bannedProperties: ["dashOffset", "dashPattern", "strokeStyle"] + } + + QtQuickUltralite.Extras.ItemBuffer { + allowedProperties: ["rotation", "scale", "transformOrigin"] + } +}