From 8d60a104620c83ff89b914f4ac94742c52a8ed30 Mon Sep 17 00:00:00 2001 From: Liang Qi Date: Wed, 10 Apr 2013 12:45:45 +0200 Subject: QWindow: expose active as property And add activeChanged signal for it. Change-Id: I9ebe9263e99863267c3a81b9286eaa5b29222085 Reviewed-by: Gunnar Sletta --- src/gui/kernel/qguiapplication.cpp | 4 ++++ src/gui/kernel/qwindow.cpp | 8 ++++++++ src/gui/kernel/qwindow.h | 2 ++ 3 files changed, 14 insertions(+) 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 @@ -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. 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); -- cgit v1.2.3