diff options
author | Liang Qi <liang.qi@digia.com> | 2013-04-10 12:45:45 +0200 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-04-23 12:45:32 +0200 |
commit | 8d60a104620c83ff89b914f4ac94742c52a8ed30 (patch) | |
tree | 24b3b95c17a99d64522d58da7e5d313807690176 /src | |
parent | 941f7a5283cf7331d8b079c6b0561ab6627cf108 (diff) |
QWindow: expose active as property
And add activeChanged signal for it.
Change-Id: I9ebe9263e99863267c3a81b9286eaa5b29222085
Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 4 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 8 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.h | 2 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index fba516c135..585eca84ca 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -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) diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 8c9bc575bd..0dd85f2d56 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -874,6 +874,14 @@ bool QWindow::isExposed() const } /*! + \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. This is the case for the window that has input focus as well as windows diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 8f32ff6813..79f90f2c62 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -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); |