QmlDesigner: Disable Properties unavailable in QUL

Disabling properties in:
 MouseArea
 Flickable
 Image
 Text (including Font)

Change-Id: Id0a44fa73ff80bf4749c0bdc0f9eac3e2f488762
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
Aleksei German
2020-08-31 18:37:22 +02:00
parent e65e4b81ea
commit f43b81ae6f
8 changed files with 142 additions and 9 deletions

View File

@@ -70,12 +70,14 @@ Column {
Label { Label {
text: qsTr("Source size") text: qsTr("Source size")
disabledState: !backendValues.sourceSize.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
Label { Label {
text: "W" text: "W"
width: 12 width: 12
disabledState: !backendValues.sourceSize_width.isAvailable
} }
SpinBox { SpinBox {
@@ -83,6 +85,7 @@ Column {
minimumValue: 0 minimumValue: 0
maximumValue: 8192 maximumValue: 8192
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
Item { Item {
@@ -93,6 +96,7 @@ Column {
Label { Label {
text: "H" text: "H"
width: 12 width: 12
disabledState: !backendValues.sourceSize_height.isAvailable
} }
SpinBox { SpinBox {
@@ -100,6 +104,7 @@ Column {
minimumValue: 0 minimumValue: 0
maximumValue: 8192 maximumValue: 8192
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {

View File

@@ -40,6 +40,7 @@ Column {
Label { Label {
text: qsTr("Enabled") text: qsTr("Enabled")
tooltip: qsTr("This property holds whether the item accepts mouse events.") tooltip: qsTr("This property holds whether the item accepts mouse events.")
disabledState: !backendValues.enabled.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -47,6 +48,7 @@ Column {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.enabled backendValue: backendValues.enabled
text: backendValues.enabled.valueToString text: backendValues.enabled.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
@@ -56,6 +58,7 @@ Column {
Label { Label {
text: qsTr("Hover enabled") text: qsTr("Hover enabled")
tooltip: qsTr("This property holds whether hover events are handled.") tooltip: qsTr("This property holds whether hover events are handled.")
disabledState: !backendValues.hoverEnabled.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -63,6 +66,7 @@ Column {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.hoverEnabled backendValue: backendValues.hoverEnabled
text: backendValues.hoverEnabled.valueToString text: backendValues.hoverEnabled.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
@@ -72,6 +76,7 @@ Column {
Label { Label {
text: qsTr("Accepted buttons") text: qsTr("Accepted buttons")
tooltip: qsTr("This property holds the mouse buttons that the mouse area reacts to.") tooltip: qsTr("This property holds the mouse buttons that the mouse area reacts to.")
disabledState: !backendValues.acceptedButtons.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -80,6 +85,7 @@ Column {
model: ["LeftButton", "RightButton", "MiddleButton", "BackButton", "ForwardButton", "AllButtons"] model: ["LeftButton", "RightButton", "MiddleButton", "BackButton", "ForwardButton", "AllButtons"]
Layout.fillWidth: true Layout.fillWidth: true
scope: "Qt" scope: "Qt"
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -104,6 +110,7 @@ Column {
Label { Label {
text: qsTr("Scroll gesture enabled") text: qsTr("Scroll gesture enabled")
tooltip: qsTr("This property controls whether this MouseArea responds to scroll gestures from non-mouse devices.") tooltip: qsTr("This property controls whether this MouseArea responds to scroll gestures from non-mouse devices.")
disabledState: !backendValues.scrollGestureEnabled.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -111,6 +118,7 @@ Column {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.scrollGestureEnabled backendValue: backendValues.scrollGestureEnabled
text: backendValues.scrollGestureEnabled.valueToString text: backendValues.scrollGestureEnabled.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
@@ -120,6 +128,7 @@ Column {
Label { Label {
text: qsTr("Cursor shape") text: qsTr("Cursor shape")
tooltip: qsTr("This property holds the cursor shape for this mouse area.") tooltip: qsTr("This property holds the cursor shape for this mouse area.")
disabledState: !backendValues.cursorShape.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -133,6 +142,7 @@ Column {
"DragMoveCursor", "DragLinkCursor"] "DragMoveCursor", "DragLinkCursor"]
Layout.fillWidth: true Layout.fillWidth: true
scope: "Qt" scope: "Qt"
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -141,6 +151,7 @@ Column {
Label { Label {
text: qsTr("Prevent stealing") text: qsTr("Prevent stealing")
tooltip: qsTr("This property controls whether the mouse events may be stolen from this MouseArea.") tooltip: qsTr("This property controls whether the mouse events may be stolen from this MouseArea.")
disabledState: !backendValues.preventStealing.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -148,6 +159,7 @@ Column {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.preventStealing backendValue: backendValues.preventStealing
text: backendValues.preventStealing.valueToString text: backendValues.preventStealing.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
@@ -157,6 +169,7 @@ Column {
Label { Label {
text: qsTr("Propagate composed events") text: qsTr("Propagate composed events")
tooltip: qsTr("This property controls whether composed mouse events will automatically propagate to other MouseAreas.") tooltip: qsTr("This property controls whether composed mouse events will automatically propagate to other MouseAreas.")
disabledState: !backendValues.propagateComposedEvents.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -164,6 +177,7 @@ Column {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.propagateComposedEvents backendValue: backendValues.propagateComposedEvents
text: backendValues.propagateComposedEvents.valueToString text: backendValues.propagateComposedEvents.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
@@ -176,6 +190,7 @@ Column {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
caption: qsTr("Drag") caption: qsTr("Drag")
visible: backendValues.drag_target.isAvailable
SectionLayout { SectionLayout {
Label { Label {

View File

@@ -56,6 +56,7 @@ Column {
anchors.left: parent.left anchors.left: parent.left
anchors.right: parent.right anchors.right: parent.right
caption: qsTr("Style Color") caption: qsTr("Style Color")
visible: backendValues.styleColor.isAvailable
ColorEditor { ColorEditor {
caption: qsTr("Style Color") caption: qsTr("Style Color")

View File

@@ -42,6 +42,7 @@ Section {
Label { Label {
text: qsTr("Flick direction") text: qsTr("Flick direction")
disabledState: !backendValues.flickableDirection.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -50,6 +51,7 @@ Section {
model: ["AutoFlickDirection", "AutoFlickIfNeeded", "HorizontalFlick", "VerticalFlick", "HorizontalAndVerticalFlick"] model: ["AutoFlickDirection", "AutoFlickIfNeeded", "HorizontalFlick", "VerticalFlick", "HorizontalAndVerticalFlick"]
Layout.fillWidth: true Layout.fillWidth: true
scope: "Flickable" scope: "Flickable"
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -58,6 +60,7 @@ Section {
Label { Label {
text: qsTr("Behavior") text: qsTr("Behavior")
tooltip: qsTr("Determines whether the surface may be dragged beyond the Flickable's boundaries, or overshoot the Flickable's boundaries when flicked.") tooltip: qsTr("Determines whether the surface may be dragged beyond the Flickable's boundaries, or overshoot the Flickable's boundaries when flicked.")
disabledState: !backendValues.boundsBehavior.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -66,6 +69,7 @@ Section {
model: ["StopAtBounds", "DragOverBounds", "OvershootBounds", "DragAndOvershootBounds"] model: ["StopAtBounds", "DragOverBounds", "OvershootBounds", "DragAndOvershootBounds"]
Layout.fillWidth: true Layout.fillWidth: true
scope: "Flickable" scope: "Flickable"
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -75,6 +79,7 @@ Section {
Label { Label {
text: qsTr("Movement") text: qsTr("Movement")
tooltip: qsTr("Determines whether the Flickable will give a feeling that the edges of the view are soft, rather than a hard physical boundary.") tooltip: qsTr("Determines whether the Flickable will give a feeling that the edges of the view are soft, rather than a hard physical boundary.")
disabledState: !backendValues.boundsMovement.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -83,6 +88,7 @@ Section {
model: ["FollowBoundsBehavior", "StopAtBounds"] model: ["FollowBoundsBehavior", "StopAtBounds"]
Layout.fillWidth: true Layout.fillWidth: true
scope: "Flickable" scope: "Flickable"
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -122,6 +128,7 @@ Section {
Label { Label {
text: qsTr("Deceleration") text: qsTr("Deceleration")
tooltip: qsTr("Flick deceleration") tooltip: qsTr("Flick deceleration")
disabledState: !backendValues.flickDeceleration.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -130,6 +137,7 @@ Section {
minimumValue: 0 minimumValue: 0
maximumValue: 8000 maximumValue: 8000
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -138,6 +146,7 @@ Section {
Label { Label {
text: qsTr("Press delay") text: qsTr("Press delay")
tooltip: qsTr("Holds the time to delay (ms) delivering a press to children of the Flickable.") tooltip: qsTr("Holds the time to delay (ms) delivering a press to children of the Flickable.")
disabledState: !backendValues.pressDelay.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -146,6 +155,7 @@ Section {
minimumValue: 0 minimumValue: 0
maximumValue: 2000 maximumValue: 2000
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -154,6 +164,7 @@ Section {
Label { Label {
text: qsTr("Pixel aligned") text: qsTr("Pixel aligned")
tooltip: qsTr("Sets the alignment of contentX and contentY to pixels (true) or subpixels (false).") tooltip: qsTr("Sets the alignment of contentX and contentY to pixels (true) or subpixels (false).")
disabledState: !backendValues.pixelAligned.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -161,6 +172,7 @@ Section {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.pixelAligned backendValue: backendValues.pixelAligned
text: backendValues.pixelAligned.valueToString text: backendValues.pixelAligned.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -171,6 +183,7 @@ Section {
tooltip: qsTr("If set to true, then when the mouse or touchpoint moves far enough to begin dragging\n" tooltip: qsTr("If set to true, then when the mouse or touchpoint moves far enough to begin dragging\n"
+ "the content, the content will jump, such that the content pixel which was under the\n" + "the content, the content will jump, such that the content pixel which was under the\n"
+ "cursor or touchpoint when pressed remains under that point.") + "cursor or touchpoint when pressed remains under that point.")
disabledState: !backendValues.synchronousDrag.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
@@ -178,6 +191,7 @@ Section {
Layout.fillWidth: true Layout.fillWidth: true
backendValue: backendValues.synchronousDrag backendValue: backendValues.synchronousDrag
text: backendValues.synchronousDrag.valueToString text: backendValues.synchronousDrag.valueToString
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -265,12 +279,15 @@ Section {
Label { Label {
text: qsTr("Origin") text: qsTr("Origin")
disabledState: (!backendValues.originX.isAvailable
&& !backendValues.originY.isAvailable)
} }
SecondColumnLayout { SecondColumnLayout {
Label { Label {
text: "X" text: "X"
width: root.labelWidth width: root.labelWidth
disabledState: !backendValues.originX.isAvailable
} }
SpinBox { SpinBox {
@@ -279,6 +296,7 @@ Section {
maximumValue: 8000 maximumValue: 8000
implicitWidth: root.spinBoxWidth implicitWidth: root.spinBoxWidth
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Item { Item {
@@ -289,6 +307,7 @@ Section {
Label { Label {
text: "Y" text: "Y"
width: root.labelWidth width: root.labelWidth
disabledState: !backendValues.originY.isAvailable
} }
SpinBox { SpinBox {
@@ -297,6 +316,7 @@ Section {
maximumValue: 8000 maximumValue: 8000
implicitWidth: root.spinBoxWidth implicitWidth: root.spinBoxWidth
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -304,6 +324,10 @@ Section {
Label { Label {
text: qsTr("Margins") text: qsTr("Margins")
disabledState: (!backendValues.topMargin.isAvailable
&& !backendValues.bottomMargin.isAvailable
&& !backendValues.leftMargin.isAvailable
&& !backendValues.rightMargin.isAvailable)
} }
SecondColumnLayout { SecondColumnLayout {
@@ -312,6 +336,7 @@ Section {
Label { Label {
text: "Top" text: "Top"
width: root.labelWidth width: root.labelWidth
disabledState: !backendValues.topMargin.isAvailable
} }
SpinBox { SpinBox {
@@ -321,6 +346,7 @@ Section {
decimals: 0 decimals: 0
implicitWidth: root.spinBoxWidth implicitWidth: root.spinBoxWidth
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Item { Item {
@@ -331,6 +357,7 @@ Section {
Label { Label {
text: "Bottom" text: "Bottom"
width: root.labelWidth width: root.labelWidth
disabledState: !backendValues.bottomMargin.isAvailable
} }
SpinBox { SpinBox {
@@ -340,6 +367,7 @@ Section {
decimals: 0 decimals: 0
implicitWidth: root.spinBoxWidth implicitWidth: root.spinBoxWidth
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }
@@ -355,6 +383,7 @@ Section {
Label { Label {
text: "Left" text: "Left"
width: root.labelWidth width: root.labelWidth
disabledState: !backendValues.leftMargin.isAvailable
} }
SpinBox { SpinBox {
@@ -364,6 +393,7 @@ Section {
decimals: 0 decimals: 0
implicitWidth: root.spinBoxWidth implicitWidth: root.spinBoxWidth
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Item { Item {
@@ -374,6 +404,7 @@ Section {
Label { Label {
text: "Right" text: "Right"
width: root.labelWidth width: root.labelWidth
disabledState: !backendValues.rightMargin.isAvailable
} }
SpinBox { SpinBox {
@@ -383,6 +414,7 @@ Section {
decimals: 0 decimals: 0
implicitWidth: root.spinBoxWidth implicitWidth: root.spinBoxWidth
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
ExpandingSpacer { ExpandingSpacer {
} }

View File

@@ -153,12 +153,13 @@ Section {
italic: fontSection.italicStyle italic: fontSection.italicStyle
underline: fontSection.underlineStyle underline: fontSection.underlineStyle
strikeout: fontSection.strikeoutStyle strikeout: fontSection.strikeoutStyle
enabled: !styleComboBox.styleSet enabled: !styleNameComboBox.styleSet
} }
Label { Label {
text: qsTr("Font capitalization") text: qsTr("Font capitalization")
toolTip: qsTr("Sets the capitalization for the text.") toolTip: qsTr("Sets the capitalization for the text.")
disabledState: !getBackendValue("capitalization").isAvailable
} }
ComboBox { ComboBox {
@@ -166,6 +167,7 @@ Section {
backendValue: getBackendValue("capitalization") backendValue: getBackendValue("capitalization")
model: ["MixedCase", "AllUppercase", "AllLowercase", "SmallCaps", "Capitalize"] model: ["MixedCase", "AllUppercase", "AllLowercase", "SmallCaps", "Capitalize"]
scope: "Font" scope: "Font"
enabled: backendValue.isAvailable
} }
Label { Label {
@@ -178,38 +180,45 @@ Section {
backendValue: getBackendValue("weight") backendValue: getBackendValue("weight")
model: ["Normal", "Light", "ExtraLight", "Thin", "Medium", "DemiBold", "Bold", "ExtraBold", "Black"] model: ["Normal", "Light", "ExtraLight", "Thin", "Medium", "DemiBold", "Bold", "ExtraBold", "Black"]
scope: "Font" scope: "Font"
enabled: !styleComboBox.styleSet enabled: !styleNameComboBox.styleSet
} }
Label { Label {
text: qsTr("Style name") text: qsTr("Style name")
toolTip: qsTr("Sets the font's style.") toolTip: qsTr("Sets the font's style.")
disabledState: !styleNameComboBox.enabled
} }
ComboBox { ComboBox {
id: styleComboBox id: styleNameComboBox
property bool styleSet: backendValue.isInModel property bool styleSet: backendValue.isInModel
Layout.fillWidth: true Layout.fillWidth: true
backendValue: getBackendValue("styleName") backendValue: getBackendValue("styleName")
model: styleNamesForFamily(fontComboBox.familyName) model: styleNamesForFamily(fontComboBox.familyName)
valueType: ComboBox.String valueType: ComboBox.String
enabled: backendValue.isAvailable
} }
Label { Label {
visible: showStyle visible: showStyle
text: qsTr("Style") text: qsTr("Style")
disabledState: !styleComboBox.enabled
} }
ComboBox { ComboBox {
id: styleComboBox
visible: showStyle visible: showStyle
Layout.fillWidth: true Layout.fillWidth: true
backendValue: (backendValues.style === undefined) ? dummyBackendValue : backendValues.style backendValue: (backendValues.style === undefined) ? dummyBackendValue : backendValues.style
model: ["Normal", "Outline", "Raised", "Sunken"] model: ["Normal", "Outline", "Raised", "Sunken"]
scope: "Text" scope: "Text"
enabled: backendValue.isAvailable
} }
Label { Label {
text: qsTr("Spacing") text: qsTr("Spacing")
disabledState: (!getBackendValue("wordSpacing").isAvailable &&
!getBackendValue("letterSpacing").isAvailable)
} }
SecondColumnLayout { SecondColumnLayout {
@@ -222,18 +231,19 @@ Section {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: 60 Layout.minimumWidth: 60
stepSize: 0.1 stepSize: 0.1
enabled: backendValue.isAvailable
} }
Label { Label {
text: qsTr("Word") text: qsTr("Word")
tooltip: qsTr("Sets the word spacing for the font.") tooltip: qsTr("Sets the word spacing for the font.")
width: 42 width: 42
disabledState: !getBackendValue("wordSpacing").isAvailable
} }
Item { Item {
width: 4 width: 4
height: 4 height: 4
} }
SpinBox { SpinBox {
maximumValue: 500 maximumValue: 500
minimumValue: -500 minimumValue: -500
@@ -242,17 +252,21 @@ Section {
Layout.fillWidth: true Layout.fillWidth: true
Layout.minimumWidth: 60 Layout.minimumWidth: 60
stepSize: 0.1 stepSize: 0.1
enabled: backendValue.isAvailable
} }
Label { Label {
text: qsTr("Letter") text: qsTr("Letter")
tooltip: qsTr("Sets the letter spacing for the font.") tooltip: qsTr("Sets the letter spacing for the font.")
width: 42 width: 42
disabledState: !getBackendValue("letterSpacing").isAvailable
} }
} }
Label { Label {
visible: minorQtQuickVersion > 9 visible: minorQtQuickVersion > 9
text: qsTr("Performance") text: qsTr("Performance")
disabledState: (!getBackendValue("kerning").isAvailable &&
!getBackendValue("preferShaping").isAvailable)
} }
SecondColumnLayout { SecondColumnLayout {
@@ -264,6 +278,7 @@ Section {
backendValue: getBackendValue("kerning") backendValue: getBackendValue("kerning")
tooltip: qsTr("Enables or disables the kerning OpenType feature when shaping the text. Disabling this may " + tooltip: qsTr("Enables or disables the kerning OpenType feature when shaping the text. Disabling this may " +
"improve performance when creating or changing the text, at the expense of some cosmetic features. The default value is true.") "improve performance when creating or changing the text, at the expense of some cosmetic features. The default value is true.")
enabled: backendValue.isAvailable
} }
CheckBox { CheckBox {
@@ -273,12 +288,14 @@ Section {
tooltip: qsTr("Sometimes, a font will apply complex rules to a set of characters in order to display them correctly.\n" + tooltip: qsTr("Sometimes, a font will apply complex rules to a set of characters in order to display them correctly.\n" +
"In some writing systems, such as Brahmic scripts, this is required in order for the text to be legible, whereas in " + "In some writing systems, such as Brahmic scripts, this is required in order for the text to be legible, whereas in " +
"Latin script,\n it is merely a cosmetic feature. Setting the preferShaping property to false will disable all such features\nwhen they are not required, which will improve performance in most cases.") "Latin script,\n it is merely a cosmetic feature. Setting the preferShaping property to false will disable all such features\nwhen they are not required, which will improve performance in most cases.")
enabled: backendValue.isAvailable
} }
} }
Label { Label {
text: qsTr("Hinting preference") text: qsTr("Hinting preference")
toolTip: qsTr("Sets the preferred hinting on the text.") toolTip: qsTr("Sets the preferred hinting on the text.")
disabledState: !getBackendValue("hintingPreference").isAvailable
} }
ComboBox { ComboBox {
@@ -286,6 +303,7 @@ Section {
backendValue: getBackendValue("hintingPreference") backendValue: getBackendValue("hintingPreference")
model: ["PreferDefaultHinting", "PreferNoHinting", "PreferVerticalHinting", "PreferFullHinting"] model: ["PreferDefaultHinting", "PreferNoHinting", "PreferVerticalHinting", "PreferFullHinting"]
scope: "Font" scope: "Font"
enabled: backendValue.isAvailable
} }
} }
} }

View File

@@ -37,6 +37,7 @@ ButtonRow {
BoolButtonRowButton { BoolButtonRowButton {
buttonIcon: StudioTheme.Constants.fontStyleBold buttonIcon: StudioTheme.Constants.fontStyleBold
backendValue: bold backendValue: bold
enabled: backendValue.isAvailable
} }
Item { Item {
width: 4 width: 4
@@ -45,6 +46,7 @@ ButtonRow {
BoolButtonRowButton { BoolButtonRowButton {
buttonIcon: StudioTheme.Constants.fontStyleItalic buttonIcon: StudioTheme.Constants.fontStyleItalic
backendValue: italic backendValue: italic
enabled: backendValue.isAvailable
} }
Item { Item {
width: 4 width: 4
@@ -53,6 +55,7 @@ ButtonRow {
BoolButtonRowButton { BoolButtonRowButton {
buttonIcon: StudioTheme.Constants.fontStyleUnderline buttonIcon: StudioTheme.Constants.fontStyleUnderline
backendValue: underline backendValue: underline
enabled: backendValue.isAvailable
} }
Item { Item {
width: 4 width: 4
@@ -61,5 +64,6 @@ ButtonRow {
BoolButtonRowButton { BoolButtonRowButton {
buttonIcon: StudioTheme.Constants.fontStyleStrikethrough buttonIcon: StudioTheme.Constants.fontStyleStrikethrough
backendValue: strikeout backendValue: strikeout
enabled: backendValue.isAvailable
} }
} }

View File

@@ -76,6 +76,7 @@ Section {
Label { Label {
visible: showVerticalAlignment visible: showVerticalAlignment
text: qsTr("Wrap mode") text: qsTr("Wrap mode")
disabledState: !backendValues.wrapMode.isAvailable
} }
ComboBox { ComboBox {
@@ -84,11 +85,13 @@ Section {
backendValue: backendValues.wrapMode backendValue: backendValues.wrapMode
scope: "Text" scope: "Text"
model: ["NoWrap", "WordWrap", "WrapAnywhere", "Wrap"] model: ["NoWrap", "WordWrap", "WrapAnywhere", "Wrap"]
enabled: backendValue.isAvailable
} }
Label { Label {
visible: showElide visible: showElide
text: qsTr("Elide") text: qsTr("Elide")
disabledState: !backendValues.elide.isAvailable
} }
ComboBox { ComboBox {
@@ -97,12 +100,14 @@ Section {
backendValue: backendValues.elide backendValue: backendValues.elide
scope: "Text" scope: "Text"
model: ["ElideNone", "ElideLeft", "ElideMiddle", "ElideRight"] model: ["ElideNone", "ElideLeft", "ElideMiddle", "ElideRight"]
enabled: backendValue.isAvailable
} }
Label { Label {
visible: showElide visible: showElide
text: qsTr("Maximum line count") text: qsTr("Maximum line count")
tooltip: qsTr("Limits the number of lines that the text item will show.") tooltip: qsTr("Limits the number of lines that the text item will show.")
disabledState: !backendValues.maximumLineCount.isAvailable
} }
SpinBox { SpinBox {
@@ -112,6 +117,7 @@ Section {
minimumValue: 0 minimumValue: 0
maximumValue: 10000 maximumValue: 10000
decimals: 0 decimals: 0
enabled: backendValue.isAvailable
} }
Label { Label {
@@ -135,6 +141,7 @@ Section {
Label { Label {
visible: showFormatProperty visible: showFormatProperty
text: qsTr("Format") text: qsTr("Format")
disabledState: !backendValues.textFormat.isAvailable
} }
ComboBox { ComboBox {
scope: "Text" scope: "Text"
@@ -142,23 +149,27 @@ Section {
model: ["PlainText", "RichText", "AutoText"] model: ["PlainText", "RichText", "AutoText"]
backendValue: backendValues.textFormat backendValue: backendValues.textFormat
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Label { Label {
text: qsTr("Render type") text: qsTr("Render type")
toolTip: qsTr("Override the default rendering type for this item.") toolTip: qsTr("Override the default rendering type for this item.")
disabledState: !backendValues.renderType.isAvailable
} }
ComboBox { ComboBox {
scope: "Text" scope: "Text"
model: ["QtRendering", "NativeRendering"] model: ["QtRendering", "NativeRendering"]
backendValue: backendValues.renderType backendValue: backendValues.renderType
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Label { Label {
visible: showFontSizeMode visible: showFontSizeMode
text: qsTr("Font size mode") text: qsTr("Font size mode")
toolTip: qsTr("Specifies how the font size of the displayed text is determined.") toolTip: qsTr("Specifies how the font size of the displayed text is determined.")
disabledState: !backendValues.fontSizeMode.isAvailable
} }
ComboBox { ComboBox {
id: fontSizeMode id: fontSizeMode
@@ -167,17 +178,20 @@ Section {
model: ["FixedSize", "HorizontalFit", "VerticalFit", "Fit"] model: ["FixedSize", "HorizontalFit", "VerticalFit", "Fit"]
backendValue: backendValues.fontSizeMode backendValue: backendValues.fontSizeMode
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
Label { Label {
visible: showFontSizeMode visible: showFontSizeMode
text: qsTr("Minimum size") text: qsTr("Minimum size")
disabledState: !backendValues.minimumPixelSize.isAvailable
&& !backendValues.minimumPointSize.isAvailable
} }
SecondColumnLayout { SecondColumnLayout {
visible: showFontSizeMode visible: showFontSizeMode
SpinBox { SpinBox {
enabled: fontSizeMode.currentIndex !== 0 enabled: (fontSizeMode.currentIndex !== 0) || backendValue.isAvailable
minimumValue: 0 minimumValue: 0
maximumValue: 500 maximumValue: 500
decimals: 0 decimals: 0
@@ -189,6 +203,7 @@ Section {
text: qsTr("Pixel") text: qsTr("Pixel")
tooltip: qsTr("Specifies the minimum font pixel size of scaled text.") tooltip: qsTr("Specifies the minimum font pixel size of scaled text.")
width: 42 width: 42
disabledState: !backendValues.minimumPixelSize.isAvailable
} }
Item { Item {
@@ -197,7 +212,7 @@ Section {
} }
SpinBox { SpinBox {
enabled: fontSizeMode.currentIndex !== 0 enabled: (fontSizeMode.currentIndex !== 0) || backendValue.isAvailable
minimumValue: 0 minimumValue: 0
maximumValue: 500 maximumValue: 500
decimals: 0 decimals: 0
@@ -209,6 +224,7 @@ Section {
text: qsTr("Point") text: qsTr("Point")
tooltip: qsTr("Specifies the minimum font point size of scaled text.") tooltip: qsTr("Specifies the minimum font point size of scaled text.")
width: 42 width: 42
disabledState: !backendValues.minimumPointSize.isAvailable
} }
} }
@@ -216,9 +232,11 @@ Section {
visible: showLineHeight visible: showLineHeight
text: qsTr("Line height") text: qsTr("Line height")
tooltip: qsTr("Sets the line height for the text.") tooltip: qsTr("Sets the line height for the text.")
disabledState: !lineHeightSpinBox.enabled
} }
SpinBox { SpinBox {
id: lineHeightSpinBox
visible: showLineHeight visible: showLineHeight
Layout.fillWidth: true Layout.fillWidth: true
backendValue: (backendValues.lineHeight === undefined) ? dummyBackendValue : backendValues.lineHeight backendValue: (backendValues.lineHeight === undefined) ? dummyBackendValue : backendValues.lineHeight
@@ -226,12 +244,14 @@ Section {
minimumValue: 0 minimumValue: 0
decimals: 2 decimals: 2
stepSize: 0.1 stepSize: 0.1
enabled: backendValue.isAvailable
} }
Label { Label {
visible: showLineHeight visible: showLineHeight
text: qsTr("Line height mode") text: qsTr("Line height mode")
toolTip: qsTr("Determines how the line height is specified.") toolTip: qsTr("Determines how the line height is specified.")
disabledState: !backendValues.lineHeightMode.isAvailable
} }
ComboBox { ComboBox {
visible: showLineHeight visible: showLineHeight
@@ -239,6 +259,7 @@ Section {
model: ["ProportionalHeight", "FixedHeight"] model: ["ProportionalHeight", "FixedHeight"]
backendValue: backendValues.lineHeightMode backendValue: backendValues.lineHeightMode
Layout.fillWidth: true Layout.fillWidth: true
enabled: backendValue.isAvailable
} }
} }

View File

@@ -271,21 +271,58 @@ static bool itemOrImage(const QmlDesigner::NodeMetaInfo &metaInfo)
return false; return false;
} }
static QList<QByteArray> prepareNonMcuProperties()
{
QList<QByteArray> result;
const QList<QByteArray> itemProperties = {"layer", "opacity", "gradient", "smooth", "antialiasing",
"border", "baselineOffset", "focus", "activeFocusOnTab"};
const QList<QByteArray> mouseAreaProperties = {"propagateComposedEvents", "preventStealing", "cursorShape",
"scrollGestureEnabled", "drag", "acceptedButtons", "hoverEnabled"};
const QList<QByteArray> flickableProperties = {"boundsBehavior", "boundsMovement",
"flickDeceleration", "flickableDirection",
"leftMargin", "rightMargin", "bottomMargin", "topMargin",
"originX", "originY",
"pixelAligned", "pressDelay", "synchronousDrag"};
const QList<QByteArray> imageProperties = {"mirror", "mipmap", "cache", "autoTransform", "asynchronous",
"sourceSize", "smooth"};
const QList<QByteArray> textProperties = {"elide", "lineHeight", "lineHeightMode", "wrapMode", "style",
"styleColor", "minimumPointSize", "minimumPixelSize", "styleColor",
"fontSizeMode", "renderType", "textFormat", "maximumLineCount"};
result.append(itemProperties);
result.append(mouseAreaProperties);
result.append(flickableProperties);
result.append(imageProperties);
result.append(textProperties);
return result;
}
bool PropertyEditorValue::isAvailable() const bool PropertyEditorValue::isAvailable() const
{ {
const QList<QByteArray> mcuProperties = {"layer", "opacity", "gradient", "smooth", "antialiasing"}; const QList<QByteArray> nonMcuProperties = prepareNonMcuProperties();
const QByteArray fontPrefix = {"font"};
const QList<QByteArray> nonMcuFontProperties = {"wordSpacing", "letterSpacing", "hintingPreference",
"kerning", "preferShaping", "capitalization",
"strikeout", "underline", "styleName"};
const QList<QByteArray> mcuTransformProperties = {"rotation", "scale", "transformOrigin"}; const QList<QByteArray> mcuTransformProperties = {"rotation", "scale", "transformOrigin"};
const QList<QByteArray> list = name().split('.'); const QList<QByteArray> list = name().split('.');
const QByteArray pureName = list.first(); const QByteArray pureName = list.constFirst();
QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance() QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance()
->documentManager() ->documentManager()
.currentDesignDocument(); .currentDesignDocument();
if (designDocument && designDocument->isQtForMCUsProject()) { if (designDocument && designDocument->isQtForMCUsProject()) {
if (mcuProperties.contains(pureName)) if (pureName == fontPrefix) {
if (nonMcuFontProperties.contains(list.constLast()))
return false;
}
if (nonMcuProperties.contains(pureName))
return false; return false;
if (mcuTransformProperties.contains(pureName) && !itemOrImage(m_modelNode.metaInfo())) if (mcuTransformProperties.contains(pureName) && !itemOrImage(m_modelNode.metaInfo()))
return false; return false;