summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGunnar Sletta <gunnar.sletta@nokia.com>2011-08-04 10:46:27 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-08-05 10:42:47 +0200
commit2a682d24182f53aad88ac6b585c5e565772f746f (patch)
tree5f03357be314fd74aec59b40b87a68b70b4eb8f2 /src
parent8dc2f81c9f0e6eb8cab09e5d682358fd140b49b8 (diff)
Added some convenience to QWindow
Change-Id: I367f5e3f586661322184cfa5f7653814569cb6e3 Reviewed-on: http://codereview.qt.nokia.com/2611 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/gui/kernel/qwindow.cpp13
-rw-r--r--src/gui/kernel/qwindow.h13
2 files changed, 26 insertions, 0 deletions
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index 84c02170c7..95331a2415 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -80,6 +80,19 @@ QWindow::QWindow(QWindow *parent)
QGuiApplicationPrivate::window_list.prepend(this);
}
+QWindow::QWindow(QWindowPrivate &dd, QWindow *parent)
+ : QObject(dd, parent)
+ , QSurface(QSurface::Window)
+{
+ Q_D(QWindow);
+ d->parentWindow = parent;
+ if (parent)
+ d->screen = parent->screen();
+ if (!d->screen)
+ d->screen = QGuiApplication::primaryScreen();
+ QGuiApplicationPrivate::window_list.prepend(this);
+}
+
QWindow::~QWindow()
{
if (QGuiApplicationPrivate::active_window == this)
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index adf948b65e..5b9ad4a3ed 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -45,6 +45,7 @@
#include <QtCore/QObject>
#include <QtCore/QEvent>
#include <QtCore/QMargins>
+#include <QtCore/QRect>
#include <QtGui/qsurfaceformat.h>
#include <QtGui/qwindowdefs.h>
@@ -157,6 +158,16 @@ public:
void setGeometry(const QRect &rect);
QRect geometry() const;
+ inline int width() const { return geometry().width(); }
+ inline int height() const { return geometry().height(); }
+ inline int x() const { return geometry().x(); }
+ inline int y() const { return geometry().y(); }
+
+ inline QSize size() const { return geometry().size(); }
+ inline QPoint pos() const { return geometry().topLeft(); }
+
+ inline void resize(const QSize &size) { setGeometry(QRect(pos(), size)); }
+
QMargins frameMargins() const;
void setWindowIcon(const QImage &icon) const;
@@ -208,6 +219,8 @@ protected:
virtual void wheelEvent(QWheelEvent *);
#endif
+ QWindow(QWindowPrivate &dd, QWindow *parent);
+
private:
QPlatformSurface *surfaceHandle() const;