forked from qt-creator/qt-creator
QmlDesigner: Implement usage of qtForMCUs property
If qtForMCUs is set in the qmlproject file we disable unsupported properties like roation, transformOrigin or layer. Change-Id: I75d9677beca3d4ce71f975b4f0ae75e63967d143 Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
This commit is contained in:
@@ -37,14 +37,17 @@ Section {
|
|||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: qsTr("Origin")
|
text: qsTr("Origin")
|
||||||
|
disabledState: !backendValues.transformOrigin.isAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
OriginControl {
|
OriginControl {
|
||||||
backendValue: backendValues.transformOrigin
|
backendValue: backendValues.transformOrigin
|
||||||
|
enabled: backendValues.transformOrigin.isAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
Label {
|
Label {
|
||||||
text: qsTr("Scale")
|
text: qsTr("Scale")
|
||||||
|
disabledState: !backendValues.scale.isAvailable
|
||||||
}
|
}
|
||||||
|
|
||||||
SecondColumnLayout {
|
SecondColumnLayout {
|
||||||
@@ -57,12 +60,14 @@ Section {
|
|||||||
minimumValue: -10
|
minimumValue: -10
|
||||||
maximumValue: 10
|
maximumValue: 10
|
||||||
Layout.preferredWidth: 140
|
Layout.preferredWidth: 140
|
||||||
|
enabled: backendValues.scale.isAvailable
|
||||||
}
|
}
|
||||||
ExpandingSpacer {
|
ExpandingSpacer {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Label {
|
Label {
|
||||||
text: qsTr("Rotation")
|
text: qsTr("Rotation")
|
||||||
|
disabledState: !backendValues.rotation.isAvailable
|
||||||
}
|
}
|
||||||
SecondColumnLayout {
|
SecondColumnLayout {
|
||||||
SpinBox {
|
SpinBox {
|
||||||
@@ -73,6 +78,7 @@ Section {
|
|||||||
minimumValue: -360
|
minimumValue: -360
|
||||||
maximumValue: 360
|
maximumValue: 360
|
||||||
Layout.preferredWidth: 140
|
Layout.preferredWidth: 140
|
||||||
|
enabled: backendValues.rotation.isAvailable
|
||||||
}
|
}
|
||||||
ExpandingSpacer {
|
ExpandingSpacer {
|
||||||
}
|
}
|
||||||
@@ -110,12 +116,14 @@ Section {
|
|||||||
Label {
|
Label {
|
||||||
visible: majorQtQuickVersion > 1
|
visible: majorQtQuickVersion > 1
|
||||||
text: qsTr("Smooth")
|
text: qsTr("Smooth")
|
||||||
|
disabledState: !backendValues.smooth.isAvailable
|
||||||
}
|
}
|
||||||
SecondColumnLayout {
|
SecondColumnLayout {
|
||||||
visible: majorQtQuickVersion > 1
|
visible: majorQtQuickVersion > 1
|
||||||
CheckBox {
|
CheckBox {
|
||||||
backendValue: backendValues.smooth
|
backendValue: backendValues.smooth
|
||||||
text: qsTr("Smooth sampling active")
|
text: qsTr("Smooth sampling active")
|
||||||
|
enabled: backendValues.smooth.isAvailable
|
||||||
}
|
}
|
||||||
ExpandingSpacer {
|
ExpandingSpacer {
|
||||||
}
|
}
|
||||||
@@ -124,12 +132,14 @@ Section {
|
|||||||
Label {
|
Label {
|
||||||
visible: majorQtQuickVersion > 1
|
visible: majorQtQuickVersion > 1
|
||||||
text: qsTr("Antialiasing")
|
text: qsTr("Antialiasing")
|
||||||
|
disabledState: !backendValues.antialiasing.isAvailable
|
||||||
}
|
}
|
||||||
SecondColumnLayout {
|
SecondColumnLayout {
|
||||||
visible: majorQtQuickVersion > 1
|
visible: majorQtQuickVersion > 1
|
||||||
CheckBox {
|
CheckBox {
|
||||||
backendValue: backendValues.antialiasing
|
backendValue: backendValues.antialiasing
|
||||||
text: qsTr("Anti-aliasing active")
|
text: qsTr("Anti-aliasing active")
|
||||||
|
enabled: backendValues.antialiasing.isAvailable
|
||||||
}
|
}
|
||||||
ExpandingSpacer {
|
ExpandingSpacer {
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ Section {
|
|||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
caption: qsTr("Layer")
|
caption: qsTr("Layer")
|
||||||
|
visible: backendValues.layer_effect.isAvailable
|
||||||
|
|
||||||
SectionLayout {
|
SectionLayout {
|
||||||
columns: 2
|
columns: 2
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ Column {
|
|||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
caption: qsTr("Border Color")
|
caption: qsTr("Border Color")
|
||||||
|
visible: backendValues.border_color.isAvailable
|
||||||
|
|
||||||
ColorEditor {
|
ColorEditor {
|
||||||
caption: qsTr("Border Color")
|
caption: qsTr("Border Color")
|
||||||
@@ -63,6 +64,7 @@ Column {
|
|||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.right: parent.right
|
anchors.right: parent.right
|
||||||
caption: "Rectangle"
|
caption: "Rectangle"
|
||||||
|
visible: backendValues.border_color.isAvailable
|
||||||
|
|
||||||
SectionLayout {
|
SectionLayout {
|
||||||
rows: 2
|
rows: 2
|
||||||
|
|||||||
@@ -37,7 +37,8 @@ Label {
|
|||||||
property alias toolTip: toolTipArea.tooltip
|
property alias toolTip: toolTipArea.tooltip
|
||||||
|
|
||||||
width: Math.max(Math.min(240, parent.width - 280), 50)
|
width: Math.max(Math.min(240, parent.width - 280), 50)
|
||||||
color: StudioTheme.Values.themeTextColor
|
color: label.disabledState ? StudioTheme.Values.themeDisabledTextColor : StudioTheme.Values.themeTextColor
|
||||||
|
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
|
||||||
font.pixelSize: StudioTheme.Values.myFontSize
|
font.pixelSize: StudioTheme.Values.myFontSize
|
||||||
@@ -46,9 +47,27 @@ Label {
|
|||||||
Layout.minimumWidth: width
|
Layout.minimumWidth: width
|
||||||
Layout.maximumWidth: width
|
Layout.maximumWidth: width
|
||||||
|
|
||||||
|
leftPadding: label.disabledState ? 10 : 0
|
||||||
|
rightPadding: label.disabledState ? 10 : 0
|
||||||
|
|
||||||
|
property bool disabledState: false
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "["
|
||||||
|
color: StudioTheme.Values.themeTextColor//StudioTheme.Values.themeDisabledTextColor
|
||||||
|
visible: label.disabledState
|
||||||
|
}
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "]"
|
||||||
|
color: StudioTheme.Values.themeTextColor//StudioTheme.Values.themeDisabledTextColor//
|
||||||
|
visible: label.disabledState
|
||||||
|
x: label.contentWidth + 10 + contentWidth
|
||||||
|
}
|
||||||
|
|
||||||
ToolTipArea {
|
ToolTipArea {
|
||||||
id: toolTipArea
|
id: toolTipArea
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
tooltip: label.text
|
tooltip: label.disabledState ? qsTr("This property is not available in this configuration.") : label.text
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -42,6 +42,8 @@ Item {
|
|||||||
readonly property color selectedColor: Theme.qmlDesignerBackgroundColorDarkAlternate()
|
readonly property color selectedColor: Theme.qmlDesignerBackgroundColorDarkAlternate()
|
||||||
readonly property color unselectedColor: Theme.qmlDesignerBackgroundColorDarker()
|
readonly property color unselectedColor: Theme.qmlDesignerBackgroundColorDarker()
|
||||||
|
|
||||||
|
property bool enabled: true
|
||||||
|
|
||||||
ExtendedFunctionLogic {
|
ExtendedFunctionLogic {
|
||||||
id: extFuncLogic
|
id: extFuncLogic
|
||||||
backendValue: originControl.backendValue
|
backendValue: originControl.backendValue
|
||||||
@@ -69,6 +71,7 @@ Item {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Grid {
|
Grid {
|
||||||
|
opacity: originControl.enabled ? 1 : 0.5
|
||||||
rows: 3
|
rows: 3
|
||||||
columns: 3
|
columns: 3
|
||||||
spacing: 5
|
spacing: 5
|
||||||
@@ -76,6 +79,7 @@ Item {
|
|||||||
id: grid
|
id: grid
|
||||||
|
|
||||||
function setValue(myValue) {
|
function setValue(myValue) {
|
||||||
|
if (originControl.enabled)
|
||||||
originControl.backendValue.setEnumeration("Item", myValue)
|
originControl.backendValue.setEnumeration("Item", myValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ QtObject {
|
|||||||
property string themeControlBackground: "#242424"
|
property string themeControlBackground: "#242424"
|
||||||
property string themeControlOutline: "#404040"
|
property string themeControlOutline: "#404040"
|
||||||
property string themeTextColor: "#ffffff"
|
property string themeTextColor: "#ffffff"
|
||||||
|
property string themeDisabledTextColor: "#909090"
|
||||||
|
|
||||||
property string themePanelBackground: "#2a2a2a"
|
property string themePanelBackground: "#2a2a2a"
|
||||||
property string themeHoverHighlight: "#313131"
|
property string themeHoverHighlight: "#313131"
|
||||||
|
|||||||
@@ -269,6 +269,14 @@ void DesignDocument::changeToDocumentModel()
|
|||||||
viewManager().attachViewsExceptRewriterAndComponetView();
|
viewManager().attachViewsExceptRewriterAndComponetView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DesignDocument::isQtForMCUsProject() const
|
||||||
|
{
|
||||||
|
if (m_currentTarget)
|
||||||
|
return m_currentTarget->additionalData("CustomQtForMCUs").toBool();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void DesignDocument::changeToInFileComponentModel(ComponentTextModifier *textModifer)
|
void DesignDocument::changeToInFileComponentModel(ComponentTextModifier *textModifer)
|
||||||
{
|
{
|
||||||
m_inFileComponentTextModifier.reset(textModifer);
|
m_inFileComponentTextModifier.reset(textModifer);
|
||||||
|
|||||||
@@ -97,6 +97,8 @@ public:
|
|||||||
|
|
||||||
void changeToDocumentModel();
|
void changeToDocumentModel();
|
||||||
|
|
||||||
|
bool isQtForMCUsProject() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void displayNameChanged(const QString &newFileName);
|
void displayNameChanged(const QString &newFileName);
|
||||||
void dirtyStateChanged(bool newState);
|
void dirtyStateChanged(bool newState);
|
||||||
|
|||||||
@@ -25,16 +25,18 @@
|
|||||||
|
|
||||||
#include "propertyeditorvalue.h"
|
#include "propertyeditorvalue.h"
|
||||||
|
|
||||||
|
#include <abstractview.h>
|
||||||
#include <bindingproperty.h>
|
#include <bindingproperty.h>
|
||||||
|
#include <designdocument.h>
|
||||||
|
#include <nodeproperty.h>
|
||||||
|
#include <nodemetainfo.h>
|
||||||
|
#include <qmldesignerplugin.h>
|
||||||
|
#include <qmlobjectnode.h>
|
||||||
|
|
||||||
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
#include <QRegExp>
|
#include <QRegExp>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
#include <abstractview.h>
|
|
||||||
#include <nodeproperty.h>
|
|
||||||
#include <nodemetainfo.h>
|
|
||||||
#include <qmlobjectnode.h>
|
|
||||||
#include <bindingproperty.h>
|
|
||||||
#include <utils/qtcassert.h>
|
|
||||||
|
|
||||||
//using namespace QmlDesigner;
|
//using namespace QmlDesigner;
|
||||||
|
|
||||||
@@ -261,6 +263,22 @@ bool PropertyEditorValue::isTranslated() const
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PropertyEditorValue::isAvailable() const
|
||||||
|
{
|
||||||
|
const QList<QByteArray> mcuProperties = {"layer", "opacity", "rotation", "scale", "transformOrigin", "smooth", "antialiasing", "border"};
|
||||||
|
const QList<QByteArray> list = name().split('.');
|
||||||
|
const QByteArray pureName = list.first();
|
||||||
|
|
||||||
|
QmlDesigner::DesignDocument *designDocument =
|
||||||
|
QmlDesigner::QmlDesignerPlugin::instance()->documentManager().currentDesignDocument();
|
||||||
|
|
||||||
|
|
||||||
|
if (designDocument && designDocument->isQtForMCUsProject())
|
||||||
|
return !mcuProperties.contains(pureName);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
QmlDesigner::ModelNode PropertyEditorValue::modelNode() const
|
QmlDesigner::ModelNode PropertyEditorValue::modelNode() const
|
||||||
{
|
{
|
||||||
return m_modelNode;
|
return m_modelNode;
|
||||||
|
|||||||
@@ -89,6 +89,8 @@ class PropertyEditorValue : public QObject
|
|||||||
Q_PROPERTY(QString name READ nameAsQString FINAL)
|
Q_PROPERTY(QString name READ nameAsQString FINAL)
|
||||||
Q_PROPERTY(PropertyEditorNodeWrapper* complexNode READ complexNode NOTIFY complexNodeChanged FINAL)
|
Q_PROPERTY(PropertyEditorNodeWrapper* complexNode READ complexNode NOTIFY complexNodeChanged FINAL)
|
||||||
|
|
||||||
|
Q_PROPERTY(bool isAvailable READ isAvailable NOTIFY isBoundChanged)
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PropertyEditorValue(QObject *parent=nullptr);
|
PropertyEditorValue(QObject *parent=nullptr);
|
||||||
|
|
||||||
@@ -115,6 +117,8 @@ public:
|
|||||||
|
|
||||||
bool isTranslated() const;
|
bool isTranslated() const;
|
||||||
|
|
||||||
|
bool isAvailable() const;
|
||||||
|
|
||||||
QmlDesigner::PropertyName name() const;
|
QmlDesigner::PropertyName name() const;
|
||||||
QString nameAsQString() const;
|
QString nameAsQString() const;
|
||||||
void setName(const QmlDesigner::PropertyName &name);
|
void setName(const QmlDesigner::PropertyName &name);
|
||||||
|
|||||||
Reference in New Issue
Block a user