summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl_qpa.cpp
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-05-20 19:45:38 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-05-20 19:46:19 +0200
commitd671acd5b296b83440db9836a92189c501c87ff3 (patch)
treebd9c1a000e17c70124c207666cfb3276b5518ffd /src/opengl/qgl_qpa.cpp
parent42f5786104f9eef9542df2c7469a03324978281d (diff)
parent4f2138ecfbdc58e5cb5b0c7d762197ef69752957 (diff)
Merge remote branch 'staging/master' into refactor
Conflicts: src/opengl/qgl_qpa.cpp src/plugins/platforms/glxconvenience/qglxconvenience.cpp src/plugins/platforms/platforms.pro src/plugins/platforms/wayland/qwaylandwindow.cpp src/plugins/platforms/xcb/qxcbwindow.cpp src/plugins/platforms/xcb/qxcbwindow.h src/plugins/platforms/xcb/qxcbwindowsurface.cpp src/widgets/kernel/qwidget_qpa.cpp tests/auto/qvariant/tst_qvariant.cpp
Diffstat (limited to 'src/opengl/qgl_qpa.cpp')
-rw-r--r--src/opengl/qgl_qpa.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp
index 5eaaee9702..9c3d4246ae 100644
--- a/src/opengl/qgl_qpa.cpp
+++ b/src/opengl/qgl_qpa.cpp
@@ -83,21 +83,21 @@ QGLFormat QGLFormat::fromWindowFormat(const QWindowFormat &format)
QWindowFormat QGLFormat::toWindowFormat(const QGLFormat &format)
{
QWindowFormat retFormat;
- if (format.alphaBufferSize() >= 0)
- retFormat.setAlphaBufferSize(format.alphaBufferSize());
+ if (format.alpha())
+ retFormat.setAlphaBufferSize(format.alphaBufferSize() == -1 ? 1 : format.alphaBufferSize());
if (format.blueBufferSize() >= 0)
retFormat.setBlueBufferSize(format.blueBufferSize());
if (format.greenBufferSize() >= 0)
retFormat.setGreenBufferSize(format.greenBufferSize());
if (format.redBufferSize() >= 0)
retFormat.setRedBufferSize(format.redBufferSize());
- if (format.depthBufferSize() >= 0)
- retFormat.setDepthBufferSize(format.depthBufferSize());
+ if (format.depth())
+ retFormat.setDepthBufferSize(format.depthBufferSize() == -1 ? 1 : format.depthBufferSize());
retFormat.setSwapBehavior(format.doubleBuffer() ? QWindowFormat::DoubleBuffer : QWindowFormat::DefaultSwapBehavior);
- if (format.sampleBuffers() && format.samples() > 1)
- retFormat.setSamples(format.samples());
- if (format.stencil() && format.stencilBufferSize() > 0)
- retFormat.setStencilBufferSize(format.stencilBufferSize());
+ if (format.sampleBuffers())
+ retFormat.setSamples(format.samples() == -1 ? 4 : format.samples());
+ if (format.stencil())
+ retFormat.setStencilBufferSize(format.stencilBufferSize() == -1 ? 1 : format.stencilBufferSize());
retFormat.setStereo(format.stereo());
return retFormat;
}
@@ -138,6 +138,8 @@ bool QGLContext::chooseContext(const QGLContext* shareContext)
winFormat.setSharedContext(shareContext->d_func()->windowContext);
}
widget->windowHandle()->setSurfaceType(QWindow::OpenGLSurface);
+ if (widget->testAttribute(Qt::WA_TranslucentBackground))
+ winFormat.setAlphaBufferSize(qMax(winFormat.alphaBufferSize(), 8));
winFormat.setWindowSurface(false);
widget->windowHandle()->setWindowFormat(winFormat);
widget->winId();//make window