summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/opengl/hellowindow/hellowindow.cpp1
-rw-r--r--src/gui/kernel/qwindow.cpp12
-rw-r--r--src/gui/kernel/qwindow.h5
-rw-r--r--src/gui/kernel/qwindow_p.h2
-rw-r--r--src/opengl/qgl_qpa.cpp2
5 files changed, 22 insertions, 0 deletions
diff --git a/examples/opengl/hellowindow/hellowindow.cpp b/examples/opengl/hellowindow/hellowindow.cpp
index afdf08026a..9575d3e3c7 100644
--- a/examples/opengl/hellowindow/hellowindow.cpp
+++ b/examples/opengl/hellowindow/hellowindow.cpp
@@ -24,6 +24,7 @@ HelloWindow::HelloWindow(Renderer *renderer)
: m_colorIndex(0)
, m_renderer(renderer)
{
+ setSurfaceType(QWindow::OpenGLSurface);
setWindowTitle(QLatin1String("Hello Window"));
setFormat(renderer->format());
diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp
index d060adf89e..7fa9316878 100644
--- a/src/gui/kernel/qwindow.cpp
+++ b/src/gui/kernel/qwindow.cpp
@@ -72,6 +72,18 @@ QWindow::~QWindow()
destroy();
}
+void QWindow::setSurfaceType(SurfaceType surfaceType)
+{
+ Q_D(QWindow);
+ d->surfaceType = surfaceType;
+}
+
+QWindow::SurfaceType QWindow::surfaceType() const
+{
+ Q_D(const QWindow);
+ return d->surfaceType;
+}
+
void QWindow::setVisible(bool visible)
{
Q_D(QWindow);
diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h
index 20b6074274..67330e5291 100644
--- a/src/gui/kernel/qwindow.h
+++ b/src/gui/kernel/qwindow.h
@@ -100,9 +100,14 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface
Q_PROPERTY(QString windowTitle READ windowTitle WRITE setWindowTitle)
public:
+ enum SurfaceType { RasterSurface, OpenGLSurface };
+
QWindow(QWindow *parent = 0);
virtual ~QWindow();
+ void setSurfaceType(SurfaceType surfaceType);
+ SurfaceType surfaceType() const;
+
void setVisible(bool visible);
bool visible() const;
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index a8b118319d..cca20bc30a 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -59,6 +59,7 @@ class Q_GUI_EXPORT QWindowPrivate : public QObjectPrivate
public:
QWindowPrivate()
: QObjectPrivate()
+ , surfaceType(QWindow::RasterSurface)
, windowFlags(Qt::Window)
, parentWindow(0)
, platformWindow(0)
@@ -75,6 +76,7 @@ public:
{
}
+ QWindow::SurfaceType surfaceType;
Qt::WindowFlags windowFlags;
QWindow *parentWindow;
QPlatformWindow *platformWindow;
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp
index 661f120601..7a4fb2c1a7 100644
--- a/src/opengl/qgl_qpa.cpp
+++ b/src/opengl/qgl_qpa.cpp
@@ -143,6 +143,7 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
winFormat.setAlphaBufferSize(qMax(winFormat.alphaBufferSize(), 8));
if (!widget->windowHandle()->handle()) {
+ widget->windowHandle()->setSurfaceType(QWindow::OpenGLSurface);
widget->windowHandle()->setFormat(winFormat);
widget->winId();//make window
}
@@ -294,6 +295,7 @@ QGLTemporaryContext::QGLTemporaryContext(bool, QWidget *)
d->oldContext = const_cast<QGLContext *>(QGLContext::currentContext());
d->window = new QWindow;
+ d->window->setSurfaceType(QWindow::OpenGLSurface);
d->window->setGeometry(QRect(0, 0, 3, 3));
d->window->create();