summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-06-08 15:08:45 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2020-06-09 16:34:28 +0000
commitfb1df81a3a5cd1d1a9228900b5573533cd7bbd73 (patch)
treebabfd70ecaeff72ceeea7e77c12c2000260d65c3 /examples
parent11b5bf3ebe15199e720282e51daf53ace88f6667 (diff)
Fix OpenGL mode in examples like composition
To avoid an incorrect offset for the native window, call create() after createWindowContainer(). The mysterious -1 for the width and height are removed as well because otherwise the GL window's size is clearly off by one. Fixes: QTBUG-82195 Change-Id: I1a9cec62746fc110bfc4cd2e4fa111f621124638 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> (cherry picked from commit d4548751b7b4183ab433df0927d59e3a6650625a) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples')
-rw-r--r--examples/widgets/painting/shared/arthurwidgets.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/examples/widgets/painting/shared/arthurwidgets.cpp b/examples/widgets/painting/shared/arthurwidgets.cpp
index 40d712c9e3..7ad0fbac91 100644
--- a/examples/widgets/painting/shared/arthurwidgets.cpp
+++ b/examples/widgets/painting/shared/arthurwidgets.cpp
@@ -127,9 +127,11 @@ void ArthurFrame::createGlWindow()
f.setStencilBufferSize(8);
m_glWindow->setFormat(f);
m_glWindow->setFlags(Qt::WindowTransparentForInput);
- m_glWindow->resize(width() - 1, height() - 1);
- m_glWindow->create();
+ m_glWindow->resize(width(), height());
m_glWidget = QWidget::createWindowContainer(m_glWindow, this);
+ // create() must be called after createWindowContainer() otherwise
+ // an incorrect offsetting of the position will occur.
+ m_glWindow->create();
}
#endif
@@ -233,7 +235,7 @@ void ArthurFrame::resizeEvent(QResizeEvent *e)
{
#if QT_CONFIG(opengl)
if (m_glWidget)
- m_glWidget->setGeometry(0, 0, e->size().width()-1, e->size().height()-1);
+ m_glWidget->setGeometry(0, 0, e->size().width(), e->size().height());
#endif
QWidget::resizeEvent(e);
}