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>
This commit is contained in:
parent
bc84b7d046
commit
d4548751b7
@ -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);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user