From 23b11e792cd0bd91afc026b103f55d450cc20fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Fri, 8 Feb 2013 10:49:52 +0100 Subject: 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 --- src/gui/kernel/qwindow.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/gui/kernel/qwindow.h') 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_OBJECT Q_DECLARE_PRIVATE(QWindow) + 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) public: + 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); -- cgit v1.2.3