From 176f30b13739b352cbe453cba7796d9a9c808bcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 21 Jun 2011 13:39:26 +0200 Subject: 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. --- src/gui/kernel/qwindow.h | 42 +++++++++++++++++++++++++++--------------- 1 file changed, 27 insertions(+), 15 deletions(-) (limited to 'src/gui/kernel/qwindow.h') 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 #include -#include +#include #include 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; -- cgit v1.2.3