From 6c2bb2e7d799357ce065119ff6a101a75e87d30a Mon Sep 17 00:00:00 2001 From: Thomas Hartmann Date: Fri, 26 Feb 2010 14:47:15 +0100 Subject: [PATCH] QmlDesigner.propertyEditor add notifier for QWidget::visible --- .../propertyeditor/basicwidgets.cpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp b/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp index edf0616210b..170eb58842e 100644 --- a/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp +++ b/src/plugins/qmldesigner/components/propertyeditor/basicwidgets.cpp @@ -138,6 +138,8 @@ class QWidgetDeclarativeUI : public QObject Q_PROPERTY(bool mouseOver READ mouseOver NOTIFY mouseOverChanged) + Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged) + Q_CLASSINFO("DefaultProperty", "children") signals: @@ -148,6 +150,7 @@ signals: void focusChanged(); void mouseOverChanged(); void opacityChanged(); + void visibleChanged(); public: QWidgetDeclarativeUI(QObject *other) : QObject(other), _layout(0), _graphicsOpacityEffect(0) { @@ -192,6 +195,11 @@ public: emit mouseOverChanged(); } + void emitVisibleChanged() + { + emit visibleChanged(); + } + QmlListProperty children() { return QmlListProperty(this, 0, children_append, children_count, children_at, children_clear); } @@ -250,6 +258,14 @@ public: return q->y(); } + bool visible() const { + return q->isVisible(); + } + + void setVisible(bool visible) { + q->setVisible(visible); + } + int globalY() const { if (q->parentWidget()) return q->mapToGlobal(QPoint(1,y())).y(); @@ -511,6 +527,13 @@ bool ResizeEventFilter::eventFilter(QObject *obj, QEvent *event) m_dui_target->emitMouseOverChanged(); return QObject::eventFilter(obj, event); } + } else if ((event->type() == QEvent::Show) || (event->type() == QEvent::Hide)) { + if (obj + && obj->isWidgetType() + && obj == m_target) { + m_dui_target->emitVisibleChanged(); + return QObject::eventFilter(obj, event); + } } return QObject::eventFilter(obj, event); }