aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHenning Gruendl <henning.gruendl@qt.io>2021-12-09 19:53:06 +0100
committerHenning Gründl <henning.gruendl@qt.io>2021-12-13 14:22:33 +0000
commit5abae40f31a85a7b89a055b75cc9773ab8c0eb4e (patch)
tree8148cf924006013005063ea51127632f6c9a1087
parent749bc57046386fef84efc2e8766d6de091380961 (diff)
QmlDesigner: Fix PropertyEditor warnings
* Replace dummyBackendValue when it causes type mismatch. Assigning #000000 (string) to a SpinBox value (double) isn't supported. * Fix backendValue undefined warnings * TextInputSpecifics hide text format control as not available Change-Id: I68381a54d1cc4603da1f2af08fa029b5afe94937 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TextEditorTemplate.template2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml2
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml21
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CharacterSection.qml5
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontExtrasSection.qml11
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml5
-rw-r--r--share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/TextExtrasSection.qml53
7 files changed, 59 insertions, 40 deletions
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TextEditorTemplate.template b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TextEditorTemplate.template
index 8e435818de..a8ba20cafd 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TextEditorTemplate.template
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/PropertyTemplates/TextEditorTemplate.template
@@ -136,7 +136,7 @@ Section {
SpinBox {
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
- backendValue: (backendValues.%2_lineHeight === undefined) ? dummyBackendValue : backendValues.lineHeight
+ backendValue: (backendValues.%2_lineHeight === undefined) ? 1.0 : backendValues.lineHeight
maximumValue: 500
minimumValue: 0
decimals: 2
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml
index 0deb638a36..f8deaaf8b8 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSection.qml
@@ -199,7 +199,7 @@ Section {
id: checkBox
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
- text: backendValue.valueToString
+ text: (checkBox.backendValue === undefined) ? "" : checkBox.backendValue.valueToString
}
ExpandingSpacer {}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml
index 18d0c00b32..f5beae9ce1 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/QtQuick/TextInputSpecifics.qml
@@ -35,18 +35,17 @@ Column {
showVerticalAlignment: true
}
- TextInputSection {
- isTextInput: true
- }
+ TextInputSection {
+ isTextInput: true
+ }
- TextExtrasSection {
- showWrapMode: true
- showFormatProperty: true
- }
+ TextExtrasSection {
+ showWrapMode: true
+ }
- FontExtrasSection {
- showStyle: false
- }
+ FontExtrasSection {
+ showStyle: false
+ }
- PaddingSection {}
+ PaddingSection {}
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CharacterSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CharacterSection.qml
index 127c7a3832..acca2a0dd1 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CharacterSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/CharacterSection.qml
@@ -353,13 +353,14 @@ Section {
id: lineHeightSpinBox
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
- backendValue: (backendValues.lineHeight === undefined) ? dummyBackendValue
+ backendValue: (backendValues.lineHeight === undefined) ? 1.0
: backendValues.lineHeight
decimals: 2
minimumValue: 0
maximumValue: 500
stepSize: 0.1
- enabled: backendValue.isAvailable
+ enabled: (backendValues.lineHeight === undefined) ? false
+ : backendValue.isAvailable
}
ExpandingSpacer {}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontExtrasSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontExtrasSection.qml
index 9084df11ab..8cf3c0fedc 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontExtrasSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/FontExtrasSection.qml
@@ -42,6 +42,13 @@ Section {
return backendValues[root.fontName + "_" + name]
}
+ function isBackendValueAvailable(name) {
+ if (backendValues[name] !== undefined)
+ return backendValues[name].isAvailable
+
+ return false
+ }
+
SectionLayout {
PropertyLabel {
text: qsTr("Capitalization")
@@ -89,11 +96,11 @@ Section {
PropertyLabel {
text: qsTr("Style color")
- visible: backendValues.styleColor.isAvailable
+ visible: root.isBackendValueAvailable("styleColor")
}
ColorEditor {
- visible: backendValues.styleColor.isAvailable
+ visible: root.isBackendValueAvailable("styleColor")
backendValue: backendValues.styleColor
supportGradient: false
}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml
index a38e5a17fa..7f98244ab2 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/StandardTextSection.qml
@@ -326,13 +326,14 @@ Section {
id: lineHeightSpinBox
implicitWidth: StudioTheme.Values.twoControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
- backendValue: (backendValues.lineHeight === undefined) ? dummyBackendValue
+ backendValue: (backendValues.lineHeight === undefined) ? 1.0
: backendValues.lineHeight
decimals: 2
minimumValue: 0
maximumValue: 500
stepSize: 0.1
- enabled: backendValue.isAvailable
+ enabled: (backendValues.lineHeight === undefined) ? false
+ : backendValue.isAvailable
}
ExpandingSpacer {}
diff --git a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/TextExtrasSection.qml b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/TextExtrasSection.qml
index 234fea36f8..d9dab055e2 100644
--- a/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/TextExtrasSection.qml
+++ b/share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/TextExtrasSection.qml
@@ -41,11 +41,20 @@ Section {
property bool showFontSizeMode: false
property bool showLineHeight: false
+ function isBackendValueAvailable(name) {
+ if (backendValues[name] !== undefined)
+ return backendValues[name].isAvailable
+
+ return false
+ }
+
SectionLayout {
+ id: sectionLayout
+
PropertyLabel {
visible: root.showWrapMode
text: qsTr("Wrap mode")
- blockedByTemplate: !backendValues.wrapMode.isAvailable
+ blockedByTemplate: !root.isBackendValueAvailable("wrapMode")
}
SecondColumnLayout {
@@ -58,7 +67,7 @@ Section {
backendValue: backendValues.wrapMode
scope: "Text"
model: ["NoWrap", "WordWrap", "WrapAnywhere", "Wrap"]
- enabled: backendValue.isAvailable
+ enabled: root.isBackendValueAvailable("wrapMode")
}
ExpandingSpacer {}
@@ -67,7 +76,7 @@ Section {
PropertyLabel {
visible: root.showElide
text: qsTr("Elide")
- blockedByTemplate: !backendValues.elide.isAvailable
+ blockedByTemplate: !root.isBackendValueAvailable("elide")
}
SecondColumnLayout {
@@ -80,7 +89,7 @@ Section {
backendValue: backendValues.elide
scope: "Text"
model: ["ElideNone", "ElideLeft", "ElideMiddle", "ElideRight"]
- enabled: backendValue.isAvailable
+ enabled: root.isBackendValueAvailable("elide")
}
ExpandingSpacer {}
@@ -89,7 +98,7 @@ Section {
PropertyLabel {
visible: root.showFormatProperty
text: qsTr("Format")
- blockedByTemplate: !backendValues.textFormat.isAvailable
+ blockedByTemplate: !root.isBackendValueAvailable("textFormat")
}
SecondColumnLayout {
@@ -100,9 +109,9 @@ Section {
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
scope: "Text"
- model: ["PlainText", "RichText", "AutoText"]
+ model: ["PlainText", "RichText", "AutoText", "StyledText", "MarkdownText"]
backendValue: backendValues.textFormat
- enabled: backendValue.isAvailable
+ enabled: root.isBackendValueAvailable("textFormat")
}
ExpandingSpacer {}
@@ -111,7 +120,7 @@ Section {
PropertyLabel {
text: qsTr("Render type")
tooltip: qsTr("Overrides the default rendering type for this component.")
- blockedByTemplate: !backendValues.renderType.isAvailable
+ blockedByTemplate: !root.isBackendValueAvailable("renderType")
}
SecondColumnLayout {
@@ -122,7 +131,7 @@ Section {
scope: "Text"
model: ["QtRendering", "NativeRendering"]
backendValue: backendValues.renderType
- enabled: backendValue.isAvailable
+ enabled: root.isBackendValueAvailable("renderType")
}
ExpandingSpacer {}
@@ -132,7 +141,7 @@ Section {
visible: root.showLineHeight
text: qsTr("Line height mode")
tooltip: qsTr("Determines how the line height is specified.")
- blockedByTemplate: !backendValues.lineHeightMode.isAvailable
+ blockedByTemplate: !root.isBackendValueAvailable("lineHeightMode")
}
SecondColumnLayout {
@@ -145,7 +154,7 @@ Section {
implicitWidth: StudioTheme.Values.singleControlColumnWidth
+ StudioTheme.Values.actionIndicatorWidth
width: implicitWidth
- enabled: backendValue.isAvailable
+ enabled: root.isBackendValueAvailable("lineHeightMode")
}
ExpandingSpacer {}
@@ -155,7 +164,7 @@ Section {
visible: root.showFontSizeMode
text: qsTr("Size mode")
tooltip: qsTr("Specifies how the font size of the displayed text is determined.")
- blockedByTemplate: !backendValues.fontSizeMode.isAvailable
+ blockedByTemplate: !root.isBackendValueAvailable("fontSizeMode")
}
SecondColumnLayout {
@@ -169,7 +178,7 @@ Section {
scope: "Text"
model: ["FixedSize", "HorizontalFit", "VerticalFit", "Fit"]
backendValue: backendValues.fontSizeMode
- enabled: backendValue.isAvailable
+ enabled: root.isBackendValueAvailable("fontSizeMode")
}
ExpandingSpacer {}
@@ -178,15 +187,16 @@ Section {
PropertyLabel {
visible: root.showFontSizeMode
text: qsTr("Min size")
- blockedByTemplate: !backendValues.minimumPixelSize.isAvailable
- && !backendValues.minimumPointSize.isAvailable
+ blockedByTemplate: !root.isBackendValueAvailable("minimumPixelSize")
+ && !root.isBackendValueAvailable("minimumPointSize")
}
SecondColumnLayout {
visible: root.showFontSizeMode
SpinBox {
- enabled: (fontSizeMode.currentIndex !== 0) || backendValue.isAvailable
+ enabled: (fontSizeMode.currentIndex !== 0)
+ || root.isBackendValueAvailable("minimumPixelSize")
minimumValue: 0
maximumValue: 500
decimals: 0
@@ -200,13 +210,14 @@ Section {
ControlLabel {
text: "px"
tooltip: qsTr("Minimum font pixel size of scaled text.")
- enabled: backendValues.minimumPixelSize.isAvailable
+ enabled: root.isBackendValueAvailable("minimumPixelSize")
}
Spacer { implicitWidth: StudioTheme.Values.controlGap }
SpinBox {
- enabled: (fontSizeMode.currentIndex !== 0) || backendValue.isAvailable
+ enabled: (fontSizeMode.currentIndex !== 0)
+ || root.isBackendValueAvailable("minimumPointSize")
minimumValue: 0
maximumValue: 500
decimals: 0
@@ -220,7 +231,7 @@ Section {
ControlLabel {
text: "pt"
tooltip: qsTr("Minimum font point size of scaled text.")
- enabled: backendValues.minimumPointSize.isAvailable
+ enabled: root.isBackendValueAvailable("minimumPointSize")
}
ExpandingSpacer {}
@@ -230,7 +241,7 @@ Section {
visible: root.showElide
text: qsTr("Max line count")
tooltip: qsTr("Limits the number of lines that the text component will show.")
- blockedByTemplate: !backendValues.maximumLineCount.isAvailable
+ blockedByTemplate: !root.isBackendValueAvailable("maximumLineCount")
}
SecondColumnLayout {
@@ -243,7 +254,7 @@ Section {
minimumValue: 0
maximumValue: 10000
decimals: 0
- enabled: backendValue.isAvailable
+ enabled: root.isBackendValueAvailable("maximumLineCount")
}
ExpandingSpacer {}