workaround for a Qt 6.5 regression ( see

https://bugreports.qt.io/browse/QTBUG-110493 )
This commit is contained in:
Uwe Rathmann 2023-01-23 15:51:21 +01:00
parent 7d1e394b43
commit 84156b138e

View File

@ -143,6 +143,7 @@ class QskWindowPrivate : public QQuickWindowPrivate
, explicitLocale( false )
, deleteOnClose( false )
, autoLayoutChildren( true )
, showedOnce( false )
{
}
@ -163,6 +164,7 @@ class QskWindowPrivate : public QQuickWindowPrivate
bool explicitLocale : 1;
bool deleteOnClose : 1;
bool autoLayoutChildren : 1;
bool showedOnce : 1;
};
QskWindow::QskWindow( QWindow* parent )
@ -303,7 +305,24 @@ bool QskWindow::event( QEvent* event )
{
case QEvent::Show:
{
if ( size().isEmpty() )
if ( !d->showedOnce )
{
d->showedOnce = true;
/*
When a window has a platform window its size is taken
from the platform window - otherwise from d->geometry.
A top level window that has not been shown does not have
a platform window yet and therefore any size set before calling
QWindow::show() is stored there.
Starting with Qt 6.5 an initial default size is set to the platform
window ( at least QXcbWindow ) before the Show event is sent
and we can't rely on QWindow::size() anymore. But even if d->geometry
is not used anymore we can initialize depending on it.
*/
if ( d->geometry.size().isEmpty() )
{
QSize sz = sizeConstraint();
if ( !sz.isEmpty() )
@ -314,6 +333,7 @@ bool QskWindow::event( QEvent* event )
resize( sz );
}
}
}
break;
}