forked from qt-creator/qt-creator
QmlDesigner.propertyEditor add notifier for QWidget::visible
This commit is contained in:
@@ -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<QObject> children() {
|
||||
return QmlListProperty<QObject>(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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user