diff options
author | Aleksei German <aleksei.german@qt.io> | 2020-08-31 18:37:22 +0200 |
---|---|---|
committer | Aleksei German <aleksei.german@qt.io> | 2020-09-01 10:03:53 +0000 |
commit | f43b81ae6f0be61b492e07fc306b7a2dc8a2ef3d (patch) | |
tree | a1b682e1b49ba13f659e1a4f22c93cc0c063f8ca /src | |
parent | e65e4b81ea1c84355f649d9eac885ba1acb51c06 (diff) |
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>
Diffstat (limited to 'src')
-rw-r--r-- | src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp | 43 |
1 files changed, 40 insertions, 3 deletions
diff --git a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp index 62de72ad05..a27a5d1b7e 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/propertyeditorvalue.cpp @@ -271,21 +271,58 @@ static bool itemOrImage(const QmlDesigner::NodeMetaInfo &metaInfo) 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 { - 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> list = name().split('.'); - const QByteArray pureName = list.first(); + const QByteArray pureName = list.constFirst(); QmlDesigner::DesignDocument *designDocument = QmlDesigner::QmlDesignerPlugin::instance() ->documentManager() .currentDesignDocument(); if (designDocument && designDocument->isQtForMCUsProject()) { - if (mcuProperties.contains(pureName)) + if (pureName == fontPrefix) { + if (nonMcuFontProperties.contains(list.constLast())) + return false; + } + if (nonMcuProperties.contains(pureName)) return false; if (mcuTransformProperties.contains(pureName) && !itemOrImage(m_modelNode.metaInfo())) return false; |