QWindow: expose active as property

And add activeChanged signal for it.

Change-Id: I9ebe9263e99863267c3a81b9286eaa5b29222085
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
This commit is contained in:
Liang Qi 2013-04-10 12:45:45 +02:00 committed by The Qt Project
parent 941f7a5283
commit 8d60a10462
3 changed files with 14 additions and 0 deletions

View File

@ -1640,6 +1640,10 @@ void QGuiApplicationPrivate::processActivatedEvent(QWindowSystemInterfacePrivate
}
emit qApp->focusWindowChanged(newFocus);
if (previous)
emit previous->activeChanged();
if (newFocus)
emit newFocus->activeChanged();
}
void QGuiApplicationPrivate::processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *wse)

View File

@ -873,6 +873,14 @@ bool QWindow::isExposed() const
return d->exposed;
}
/*!
\property QWindow::active
\brief the active status of the window
\since 5.1
\sa requestActivate()
*/
/*!
Returns true if the window should appear active from a style perspective.

View File

@ -115,6 +115,7 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged REVISION 1)
Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged REVISION 1)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
Q_PROPERTY(bool active READ isActive NOTIFY activeChanged REVISION 1)
Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged REVISION 1)
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged REVISION 1)
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged REVISION 1)
@ -310,6 +311,7 @@ Q_SIGNALS:
void visibleChanged(bool arg);
Q_REVISION(1) void visibilityChanged(QWindow::Visibility visibility);
Q_REVISION(1) void activeChanged();
Q_REVISION(1) void contentOrientationChanged(Qt::ScreenOrientation orientation);
void focusObjectChanged(QObject *object);