diff options
author | Alan Alpert <alan.alpert@nokia.com> | 2011-11-18 20:47:05 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-11-22 10:54:57 +0100 |
commit | ce829cbb857bb0b6f49de81b4e5cc9f26ac0b2d1 (patch) | |
tree | d636d971edfa93b9f1d1acc788a414c0d70d349c /src/gui/kernel/qwindow.h | |
parent | c22602160072638e0b84157757bb8ab2f982acb4 (diff) |
Add some properties to QWindow
x,y,width,height,visible and orientation
Includes slot setters and notify signals for maximal QML compatibility.
Change-Id: I124399093c00f8ad1485d4fbae816dfbe3027eff
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src/gui/kernel/qwindow.h')
-rw-r--r-- | src/gui/kernel/qwindow.h | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 1c3dd3ae67..c1dcee4121 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -85,6 +85,12 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface Q_DECLARE_PRIVATE(QWindow) Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) + Q_PROPERTY(int x READ x WRITE setX NOTIFY xChanged) + Q_PROPERTY(int y READ y WRITE setY NOTIFY yChanged) + Q_PROPERTY(int width READ width WRITE setWidth NOTIFY widthChanged) + Q_PROPERTY(int height READ height WRITE setHeight NOTIFY heightChanged) + Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged) + Q_PROPERTY(Qt::ScreenOrientation orientation READ orientation WRITE setOrientation NOTIFY orientationChanged) public: enum SurfaceType { RasterSurface, OpenGLSurface }; @@ -96,7 +102,6 @@ public: void setSurfaceType(SurfaceType surfaceType); SurfaceType surfaceType() const; - void setVisible(bool visible); bool visible() const; void create(); @@ -201,6 +206,8 @@ public: QPoint mapFromGlobal(const QPoint &pos) const; public Q_SLOTS: + void setVisible(bool visible); + inline void show() { setVisible(true); } inline void hide() { setVisible(false); } @@ -215,9 +222,45 @@ public Q_SLOTS: void setWindowTitle(const QString &); + void setX(int arg) + { + if (x() != arg) + setGeometry(QRect(arg, y(), width(), height())); + } + + void setY(int arg) + { + if (y() != arg) + setGeometry(QRect(x(), arg, width(), height())); + } + + void setWidth(int arg) + { + if (width() != arg) + setGeometry(QRect(x(), y(), arg, height())); + } + + void setHeight(int arg) + { + if (height() != arg) + setGeometry(QRect(x(), y(), width(), arg)); + } + Q_SIGNALS: void backBufferReady(); + void xChanged(int arg); + + void yChanged(int arg); + + void widthChanged(int arg); + + void heightChanged(int arg); + + void visibleChanged(bool arg); + + void orientationChanged(Qt::ScreenOrientation arg); + protected: virtual void exposeEvent(QExposeEvent *); virtual void resizeEvent(QResizeEvent *); |