diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2011-06-21 13:39:26 +0200 |
---|---|---|
committer | Samuel Rødal <samuel.rodal@nokia.com> | 2011-06-21 14:02:22 +0200 |
commit | 176f30b13739b352cbe453cba7796d9a9c808bcd (patch) | |
tree | 8fa60b6ae4ef06455652863a0406bc5e86a22303 /src/gui/kernel/qwindow.h | |
parent | 272daebaa07b21e372ad4274fafb51ce0be92396 (diff) |
OpenGL API refactor.
Rename QGuiGLFormat to QSurfaceFormat, and make QWindow sub-class of
QSurface and QPlatformWindow sub-class of QPlatformSurface, instead of
having QPlatformGLSurface accessor in QWindow.
Diffstat (limited to 'src/gui/kernel/qwindow.h')
-rw-r--r-- | src/gui/kernel/qwindow.h | 42 |
1 files changed, 27 insertions, 15 deletions
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index cfd251fff0..af882b5451 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -46,7 +46,7 @@ #include <QtCore/QEvent> #include <QtCore/QMargins> -#include <QtGui/qguiglformat_qpa.h> +#include <QtGui/qsurfaceformat.h> #include <QtGui/qwindowdefs.h> QT_BEGIN_HEADER @@ -67,11 +67,31 @@ class QMouseEvent; class QWheelEvent; #endif -class QPlatformGLSurface; +class QPlatformSurface; class QPlatformWindow; class QBackingStore; -class Q_GUI_EXPORT QWindow : public QObject +class Q_GUI_EXPORT QSurface +{ +public: + enum SurfaceType { + Window + }; + + SurfaceType surfaceType() const { return m_type; } + + virtual QSurfaceFormat format() const = 0; + virtual QPlatformSurface *surfaceHandle() const = 0; + +private: + QSurface(SurfaceType type) : m_type(type) {} + + SurfaceType m_type; + + friend class QWindow; +}; + +class Q_GUI_EXPORT QWindow : public QObject, public QSurface { Q_OBJECT Q_DECLARE_PRIVATE(QWindow) @@ -79,11 +99,6 @@ class Q_GUI_EXPORT QWindow : public QObject Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle) public: - enum SurfaceType { - RasterSurface, - OpenGLSurface - }; - QWindow(QWindow *parent = 0); virtual ~QWindow(); @@ -103,13 +118,8 @@ public: Qt::WindowModality windowModality() const; void setWindowModality(Qt::WindowModality windowModality); - void setGLFormat(const QGuiGLFormat &format); - QGuiGLFormat glFormat() const; - - QPlatformGLSurface *glSurface() const; - - void setSurfaceType(SurfaceType type); - SurfaceType surfaceType() const; + void setFormat(const QSurfaceFormat &format); + QSurfaceFormat format() const; void setWindowFlags(Qt::WindowFlags flags); Qt::WindowFlags windowFlags() const; @@ -187,6 +197,8 @@ protected: #endif private: + QPlatformSurface *surfaceHandle() const; + Q_DISABLE_COPY(QWindow) friend class QGuiApplication; |