path: root/src/gui/kernel/qwindow.h
diff options
authorSamuel Rødal <>2013-02-08 10:49:52 +0100
committerThe Qt Project <>2013-02-12 15:02:53 +0100
commit23b11e792cd0bd91afc026b103f55d450cc20fe2 (patch)
tree7e5350921467d267d61e1832c74e73ca77e7d316 /src/gui/kernel/qwindow.h
parentfe6add818e2ab11fba3d9df12c29dfb29c65b2af (diff)
Added QWindow::Visibility convenience API to QWindow.
This finally makes it possible to make windows fullscreen etc from QML by doing "visibility: Window.FullScreen". I don't see any reason from not having the API at the QWindow-level instead of at the QQuickWindow-level since this way it can benefit other use cases too. Change-Id: If27344306eb563bc2ccd83296a46b1f2862e2db1 Reviewed-by: Friedemann Kleint <> Reviewed-by: Gunnar Sletta <>
Diffstat (limited to 'src/gui/kernel/qwindow.h')
1 files changed, 15 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index e304fd4c4f..4b8f0ca3e7 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -91,6 +91,8 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
+ Q_ENUMS(Visibility)
// All properties which are declared here are inherited by QQuickWindow and therefore available in QML.
// So please think carefully about what it does to the QML namespace if you add any new ones,
// particularly the possible meanings these names might have in any specializations of Window.
@@ -109,10 +111,19 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_PROPERTY(int maximumWidth READ maximumWidth WRITE setMaximumWidth NOTIFY maximumWidthChanged)
Q_PROPERTY(int maximumHeight READ maximumHeight WRITE setMaximumHeight NOTIFY maximumHeightChanged)
Q_PROPERTY(bool visible READ isVisible WRITE setVisible NOTIFY visibleChanged)
+ Q_PROPERTY(Visibility visibility READ visibility WRITE setVisibility NOTIFY visibilityChanged)
Q_PROPERTY(Qt::ScreenOrientation contentOrientation READ contentOrientation WRITE reportContentOrientationChange NOTIFY contentOrientationChanged)
Q_PROPERTY(qreal opacity READ opacity WRITE setOpacity NOTIFY opacityChanged)
+ enum Visibility {
+ Hidden = 0,
+ AutomaticVisibility,
+ Windowed,
+ Minimized,
+ Maximized,
+ FullScreen
+ };
explicit QWindow(QScreen *screen = 0);
explicit QWindow(QWindow *parent);
@@ -123,6 +134,9 @@ public:
bool isVisible() const;
+ Visibility visibility() const;
+ void setVisibility(Visibility v);
void create();
WId winId() const;
@@ -284,6 +298,7 @@ Q_SIGNALS:
void maximumHeightChanged(int arg);
void visibleChanged(bool arg);
+ void visibilityChanged(QWindow::Visibility visibility);
void contentOrientationChanged(Qt::ScreenOrientation orientation);
void focusObjectChanged(QObject *object);