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:
parent
8dc2f81c9f
commit
2a682d2418
@ -80,6 +80,19 @@ QWindow::QWindow(QWindow *parent)
|
|||||||
QGuiApplicationPrivate::window_list.prepend(this);
|
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()
|
QWindow::~QWindow()
|
||||||
{
|
{
|
||||||
if (QGuiApplicationPrivate::active_window == this)
|
if (QGuiApplicationPrivate::active_window == this)
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QEvent>
|
#include <QtCore/QEvent>
|
||||||
#include <QtCore/QMargins>
|
#include <QtCore/QMargins>
|
||||||
|
#include <QtCore/QRect>
|
||||||
|
|
||||||
#include <QtGui/qsurfaceformat.h>
|
#include <QtGui/qsurfaceformat.h>
|
||||||
#include <QtGui/qwindowdefs.h>
|
#include <QtGui/qwindowdefs.h>
|
||||||
@ -157,6 +158,16 @@ public:
|
|||||||
void setGeometry(const QRect &rect);
|
void setGeometry(const QRect &rect);
|
||||||
QRect geometry() const;
|
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;
|
QMargins frameMargins() const;
|
||||||
|
|
||||||
void setWindowIcon(const QImage &icon) const;
|
void setWindowIcon(const QImage &icon) const;
|
||||||
@ -208,6 +219,8 @@ protected:
|
|||||||
virtual void wheelEvent(QWheelEvent *);
|
virtual void wheelEvent(QWheelEvent *);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QWindow(QWindowPrivate &dd, QWindow *parent);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPlatformSurface *surfaceHandle() const;
|
QPlatformSurface *surfaceHandle() const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user