summaryrefslogtreecommitdiffstats
path: root/examples/widgets
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-06-08 15:08:45 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-06-09 11:29:01 +0000
commitd4548751b7b4183ab433df0927d59e3a6650625a (patch)
tree5bea96efd351a2ce9627c3253830ca8b977b6fbd /examples/widgets
parentbc84b7d046092dd719bc5cd925a13fd3b23bc3a8 (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 Pick-to: 5.15 Change-Id: I1a9cec62746fc110bfc4cd2e4fa111f621124638 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'examples/widgets')
-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 e24130e464..bd8a6d7b62 100644
--- a/examples/widgets/painting/shared/arthurwidgets.cpp
+++ b/examples/widgets/painting/shared/arthurwidgets.cpp
@@ -129,9 +129,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
@@ -235,7 +237,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);
}