QmlDesigner: Hide dynamic properties if multiple items are selected

If multiple items get selected it is not clear to which item
the property belongs. Therefore we hide the section.

Task-number: QDS-7688
Change-Id: Ieaa0114d87974fea3135adc2d1bcd979c2236ed2
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
This commit is contained in:
Thomas Hartmann
2022-09-16 17:19:02 +02:00
parent 608fa309a7
commit 89535f1025
4 changed files with 26 additions and 0 deletions

View File

@@ -39,6 +39,7 @@ PropertyEditorPane {
DynamicPropertiesSection { DynamicPropertiesSection {
propertiesModel: SelectionDynamicPropertiesModel {} propertiesModel: SelectionDynamicPropertiesModel {}
visible: !hasMultiSelection
} }
GeometrySection {} GeometrySection {}

View File

@@ -42,6 +42,7 @@ PropertyEditorPane {
DynamicPropertiesSection { DynamicPropertiesSection {
propertiesModel: SelectionDynamicPropertiesModel {} propertiesModel: SelectionDynamicPropertiesModel {}
visible: !hasMultiSelection
} }
Loader { Loader {

View File

@@ -429,6 +429,20 @@ QQmlComponent *PropertyEditorContextObject::specificQmlComponent()
return m_qmlComponent; return m_qmlComponent;
} }
bool PropertyEditorContextObject::hasMultiSelection() const
{
return m_hasMultiSelection;
}
void PropertyEditorContextObject::setHasMultiSelection(bool b)
{
if (b == m_hasMultiSelection)
return;
m_hasMultiSelection = b;
emit hasMultiSelectionChanged();
}
void PropertyEditorContextObject::setSpecificsUrl(const QUrl &newSpecificsUrl) void PropertyEditorContextObject::setSpecificsUrl(const QUrl &newSpecificsUrl)
{ {
if (newSpecificsUrl == m_specificsUrl) if (newSpecificsUrl == m_specificsUrl)

View File

@@ -68,6 +68,9 @@ class PropertyEditorContextObject : public QObject
Q_PROPERTY(QQmlComponent* specificQmlComponent READ specificQmlComponent NOTIFY specificQmlComponentChanged) Q_PROPERTY(QQmlComponent* specificQmlComponent READ specificQmlComponent NOTIFY specificQmlComponentChanged)
Q_PROPERTY(bool hasMultiSelection READ hasMultiSelection WRITE setHasMultiSelection NOTIFY
hasMultiSelectionChanged)
public: public:
PropertyEditorContextObject(QObject *parent = nullptr); PropertyEditorContextObject(QObject *parent = nullptr);
@@ -126,6 +129,10 @@ public:
bool hasAliasExport() const { return m_aliasExport; } bool hasAliasExport() const { return m_aliasExport; }
bool hasMultiSelection() const;
void setHasMultiSelection(bool);
signals: signals:
void specificsUrlChanged(); void specificsUrlChanged();
void specificQmlDataChanged(); void specificQmlDataChanged();
@@ -142,6 +149,7 @@ signals:
void hasAliasExportChanged(); void hasAliasExportChanged();
void hasActiveTimelineChanged(); void hasActiveTimelineChanged();
void activeDragSuffixChanged(); void activeDragSuffixChanged();
void hasMultiSelectionChanged();
public slots: public slots:
@@ -192,6 +200,8 @@ private:
bool m_setHasActiveTimeline = false; bool m_setHasActiveTimeline = false;
QString m_activeDragSuffix; QString m_activeDragSuffix;
bool m_hasMultiSelection = false;
}; };
class EasingCurveEditor : public QObject class EasingCurveEditor : public QObject