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>
This commit is contained in:
Gunnar Sletta 2011-08-04 10:46:27 +02:00 committed by Samuel Rødal
parent 8dc2f81c9f
commit 2a682d2418
2 changed files with 26 additions and 0 deletions

View File

@ -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)

View File

@ -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;