From 5522e5cd2737b3db9f17db69ac6f950b2e58e024 Mon Sep 17 00:00:00 2001 From: Christiaan Janssen <christiaan.janssen@nokia.com> Date: Mon, 1 Mar 2010 17:22:41 +0100 Subject: [PATCH] QmlDesigner.PropertyEditor: Color coding in layout pane --- .../propertyeditor/Qt/DoubleSpinBox.qml | 4 ++++ .../qmldesigner/propertyeditor/Qt/Layout.qml | 1 + .../qmldesigner/propertyeditor/Qt/SpinBox.qml | 1 - .../propertyeditor/basicwidgets.cpp | 24 ++++++++++++++++++- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/DoubleSpinBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/DoubleSpinBox.qml index e394e1ed29b..e4d10b53b98 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/DoubleSpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/DoubleSpinBox.qml @@ -25,6 +25,10 @@ QWidget { //This is a special doubleSpinBox that does color coding for states evaluate(); } + onEnabledChanged: { + evaluate(); + } + Script { function evaluate() { if (!enabled) { diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/Layout.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/Layout.qml index 0a188ae7280..868e6e6ac41 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/Layout.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/Layout.qml @@ -56,6 +56,7 @@ GroupBox { QWidget { layout : HorizontalLayout { IntEditor { + id:topbox slider: false caption: "Margin" backendValue: backendValues.anchors_topMargin diff --git a/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml b/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml index 16f720c2f59..da69cb2b492 100644 --- a/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml +++ b/share/qtcreator/qmldesigner/propertyeditor/Qt/SpinBox.qml @@ -63,7 +63,6 @@ QWidget { //This is a special spinBox that does color coding for states ColorScheme { id:scheme; } layout: HorizontalLayout { - QSpinBox { property alias backendValue: spinBox.backendValue diff --git a/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp b/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp index bec23300326..e547b45a629 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp @@ -139,6 +139,7 @@ class QWidgetDeclarativeUI : public QObject Q_PROPERTY(bool mouseOver READ mouseOver NOTIFY mouseOverChanged) Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged) + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled NOTIFY enabledChanged) Q_CLASSINFO("DefaultProperty", "children") @@ -151,6 +152,7 @@ signals: void mouseOverChanged(); void opacityChanged(); void visibleChanged(); + void enabledChanged(); public: QWidgetDeclarativeUI(QObject *other) : QObject(other), _layout(0), _graphicsOpacityEffect(0) { @@ -201,6 +203,11 @@ public: emit visibleChanged(); } + void emitEnabledChanged() + { + emit enabledChanged(); + } + QDeclarativeListProperty<QObject> children() { return QDeclarativeListProperty<QObject>(this, 0, children_append, children_count, children_at, children_clear); } @@ -267,6 +274,14 @@ public: q->setVisible(visible); } + bool enabled() const { + return q->isEnabled(); + } + + void setEnabled(bool enabled) { + q->setEnabled(enabled); + } + int globalY() const { if (q->parentWidget()) return q->mapToGlobal(QPoint(1,y())).y(); @@ -534,7 +549,14 @@ bool ResizeEventFilter::eventFilter(QObject *obj, QEvent *event) && obj == m_target) { m_dui_target->emitVisibleChanged(); return QObject::eventFilter(obj, event); - } + } + } else if (event->type() == QEvent::EnabledChange) { + if (obj + && obj->isWidgetType() + && obj == m_target) { + m_dui_target->emitEnabledChanged(); + return QObject::eventFilter(obj,event); + } } return QObject::eventFilter(obj, event); } -- GitLab