QmlDesigner: Enable TextInput item for MCUs config

Task-number: QDS-12608
Change-Id: I5dab267b9d2e48d1c6ae1552d26ea9dab99ee424
Reviewed-by: Henning Gründl <henning.gruendl@qt.io>
(cherry picked from commit 1600a169cd)
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Aleksei German
2024-06-11 16:07:18 +02:00
committed by Thomas Hartmann
parent 5ad657ff2c
commit a965b6630f
3 changed files with 304 additions and 7 deletions

View File

@@ -14,30 +14,42 @@ Section {
property bool isTextInput: false property bool isTextInput: false
function isBackendValueAvailable(name) {
if (backendValues[name] !== undefined)
return backendValues[name].isAvailable
return false
}
SectionLayout { SectionLayout {
PropertyLabel { PropertyLabel {
text: qsTr("Selection color") text: qsTr("Selection color")
tooltip: qsTr("Sets the background color of selected text.") tooltip: qsTr("Sets the background color of selected text.")
blockedByTemplate: !root.isBackendValueAvailable("selectionColor")
} }
ColorEditor { ColorEditor {
backendValue: backendValues.selectionColor backendValue: backendValues.selectionColor
supportGradient: false supportGradient: false
enabled: root.isBackendValueAvailable("selectionColor")
} }
PropertyLabel { PropertyLabel {
text: qsTr("Selected text color") text: qsTr("Selected text color")
tooltip: qsTr("Sets the color of selected text.") tooltip: qsTr("Sets the color of selected text.")
blockedByTemplate: !root.isBackendValueAvailable("selectedTextColor")
} }
ColorEditor { ColorEditor {
backendValue: backendValues.selectedTextColor backendValue: backendValues.selectedTextColor
supportGradient: false supportGradient: false
enabled: root.isBackendValueAvailable("selectedTextColor")
} }
PropertyLabel { PropertyLabel {
text: qsTr("Selection mode") text: qsTr("Selection mode")
tooltip: qsTr("Sets the way text is selected with the mouse.") tooltip: qsTr("Sets the way text is selected with the mouse.")
blockedByTemplate: !root.isBackendValueAvailable("mouseSelectionMode")
} }
SecondColumnLayout { SecondColumnLayout {
@@ -48,6 +60,7 @@ Section {
backendValue: backendValues.mouseSelectionMode backendValue: backendValues.mouseSelectionMode
scope: root.isTextInput ? "TextInput" : "TextEdit" scope: root.isTextInput ? "TextInput" : "TextEdit"
model: ["SelectCharacters", "SelectWords"] model: ["SelectCharacters", "SelectWords"]
enabled: root.isBackendValueAvailable("mouseSelectionMode")
} }
ExpandingSpacer {} ExpandingSpacer {}
@@ -57,6 +70,7 @@ Section {
visible: root.isTextInput visible: root.isTextInput
text: qsTr("Input mask") text: qsTr("Input mask")
tooltip: qsTr("Sets the allowed characters.") tooltip: qsTr("Sets the allowed characters.")
blockedByTemplate: !root.isBackendValueAvailable("inputMask")
} }
SecondColumnLayout { SecondColumnLayout {
@@ -68,6 +82,7 @@ Section {
+ StudioTheme.Values.actionIndicatorWidth + StudioTheme.Values.actionIndicatorWidth
width: implicitWidth width: implicitWidth
showTranslateCheckBox: false showTranslateCheckBox: false
enabled: root.isBackendValueAvailable("inputMask")
} }
ExpandingSpacer {} ExpandingSpacer {}
@@ -77,6 +92,7 @@ Section {
visible: root.isTextInput visible: root.isTextInput
text: qsTr("Echo mode") text: qsTr("Echo mode")
tooltip: qsTr("Sets the visibility mode.") tooltip: qsTr("Sets the visibility mode.")
blockedByTemplate: !root.isBackendValueAvailable("echoMode")
} }
SecondColumnLayout { SecondColumnLayout {
@@ -89,6 +105,7 @@ Section {
backendValue: backendValues.echoMode backendValue: backendValues.echoMode
scope: "TextInput" scope: "TextInput"
model: ["Normal", "Password", "PasswordEchoOnEdit", "NoEcho"] model: ["Normal", "Password", "PasswordEchoOnEdit", "NoEcho"]
enabled: root.isBackendValueAvailable("echoMode")
} }
ExpandingSpacer {} ExpandingSpacer {}
@@ -98,6 +115,7 @@ Section {
visible: root.isTextInput visible: root.isTextInput
text: qsTr("Password character") text: qsTr("Password character")
tooltip: qsTr("Sets which character to display when passwords are entered.") tooltip: qsTr("Sets which character to display when passwords are entered.")
blockedByTemplate: !root.isBackendValueAvailable("passwordCharacter")
} }
SecondColumnLayout { SecondColumnLayout {
@@ -109,6 +127,7 @@ Section {
+ StudioTheme.Values.actionIndicatorWidth + StudioTheme.Values.actionIndicatorWidth
width: implicitWidth width: implicitWidth
showTranslateCheckBox: false showTranslateCheckBox: false
enabled: root.isBackendValueAvailable("passwordCharacter")
} }
ExpandingSpacer {} ExpandingSpacer {}
@@ -118,6 +137,7 @@ Section {
visible: !root.isTextInput visible: !root.isTextInput
text: qsTr("Tab stop distance") text: qsTr("Tab stop distance")
tooltip: qsTr("Default distance between tab stops in device units.") tooltip: qsTr("Default distance between tab stops in device units.")
blockedByTemplate: !root.isBackendValueAvailable("tabStopDistance")
} }
SecondColumnLayout { SecondColumnLayout {
@@ -129,6 +149,7 @@ Section {
backendValue: backendValues.tabStopDistance backendValue: backendValues.tabStopDistance
maximumValue: 200 maximumValue: 200
minimumValue: 0 minimumValue: 0
enabled: root.isBackendValueAvailable("tabStopDistance")
} }
Spacer { implicitWidth: StudioTheme.Values.controlLabelGap } Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
@@ -142,6 +163,7 @@ Section {
visible: !root.isTextInput visible: !root.isTextInput
text: qsTr("Text margin") text: qsTr("Text margin")
tooltip: qsTr("Margin around the text in the Text Edit in pixels.") tooltip: qsTr("Margin around the text in the Text Edit in pixels.")
blockedByTemplate: !root.isBackendValueAvailable("textMargin")
} }
SecondColumnLayout { SecondColumnLayout {
@@ -153,6 +175,7 @@ Section {
backendValue: backendValues.textMargin backendValue: backendValues.textMargin
maximumValue: 200 maximumValue: 200
minimumValue: -200 minimumValue: -200
enabled: root.isBackendValueAvailable("textMargin")
} }
Spacer { implicitWidth: StudioTheme.Values.controlLabelGap } Spacer { implicitWidth: StudioTheme.Values.controlLabelGap }
@@ -166,6 +189,7 @@ Section {
visible: root.isTextInput visible: root.isTextInput
text: qsTr("Maximum length") text: qsTr("Maximum length")
tooltip: qsTr("Sets the maximum length of the text.") tooltip: qsTr("Sets the maximum length of the text.")
blockedByTemplate: !root.isBackendValueAvailable("maximumLength")
} }
SecondColumnLayout { SecondColumnLayout {
@@ -177,6 +201,7 @@ Section {
backendValue: backendValues.maximumLength backendValue: backendValues.maximumLength
minimumValue: 0 minimumValue: 0
maximumValue: 32767 maximumValue: 32767
enabled: root.isBackendValueAvailable("maximumLength")
} }
ExpandingSpacer {} ExpandingSpacer {}
@@ -184,6 +209,7 @@ Section {
component FlagItem : SecondColumnLayout { component FlagItem : SecondColumnLayout {
property alias backendValue: checkBox.backendValue property alias backendValue: checkBox.backendValue
CheckBox { CheckBox {
id: checkBox id: checkBox
implicitWidth: StudioTheme.Values.twoControlColumnWidth implicitWidth: StudioTheme.Values.twoControlColumnWidth
@@ -197,64 +223,92 @@ Section {
PropertyLabel { PropertyLabel {
text: qsTr("Read only") text: qsTr("Read only")
tooltip: qsTr("Toggles if the text allows edits.") 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 { PropertyLabel {
text: qsTr("Cursor visible") text: qsTr("Cursor visible")
tooltip: qsTr("Toggles if the cursor is 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 { PropertyLabel {
text: qsTr("Focus on press") text: qsTr("Focus on press")
tooltip: qsTr("Toggles if the text is focused on mouse click.") 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 { PropertyLabel {
visible: root.isTextInput visible: root.isTextInput
text: qsTr("Auto scroll") text: qsTr("Auto scroll")
tooltip: qsTr("Toggles if the text scrolls when it exceeds its boundary.") tooltip: qsTr("Toggles if the text scrolls when it exceeds its boundary.")
blockedByTemplate: !root.isBackendValueAvailable("autoScroll")
} }
FlagItem { FlagItem {
visible: root.isTextInput visible: root.isTextInput
backendValue: backendValues.autoScroll backendValue: backendValues.autoScroll
enabled: root.isBackendValueAvailable("autoScroll")
} }
PropertyLabel { PropertyLabel {
text: qsTr("Overwrite mode") text: qsTr("Overwrite mode")
tooltip: qsTr("Toggles if overwriting text is allowed.") 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 { PropertyLabel {
text: qsTr("Persistent selection") text: qsTr("Persistent selection")
tooltip: qsTr("Toggles if the text should remain selected after moving the focus elsewhere.") 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 { PropertyLabel {
text: qsTr("Select by mouse") text: qsTr("Select by mouse")
tooltip: qsTr("Toggles if the text can be selected with the 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 { PropertyLabel {
visible: !root.isTextInput visible: !root.isTextInput
text: qsTr("Select by keyboard") text: qsTr("Select by keyboard")
blockedByTemplate: !root.isBackendValueAvailable("selectByKeyboard")
} }
FlagItem { FlagItem {
visible: !root.isTextInput visible: !root.isTextInput
backendValue: backendValues.selectByKeyboard backendValue: backendValues.selectByKeyboard
enabled: root.isBackendValueAvailable("selectByKeyboard")
} }
} }
} }

View File

@@ -5,7 +5,7 @@
Metadata { Metadata {
id: metadataFile id: metadataFile
defaultVersion: v27 defaultVersion: v28
VersionData { VersionData {
id: v14 id: v14
@@ -78,4 +78,10 @@ Metadata {
name: "Qt for MCUs 2.7" name: "Qt for MCUs 2.7"
path: "qul-27.qml" path: "qul-27.qml"
} }
VersionData {
id: v28
name: "Qt for MCUs 2.8"
path: "qul-28.qml"
}
} }

View File

@@ -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"]
}
}