mirror of
https://github.com/qgis/QGIS.git
synced 2025-11-13 00:07:27 -05:00
Fix dock widget sizes are not correctly restored
Because of upstream regression https://bugreports.qt.io/browse/QTBUG-89034 we have to hack around this bug downstream Fixes #44186
This commit is contained in:
parent
55485d38cf
commit
d16d76155e
@ -5159,11 +5159,15 @@ void QgisApp::restoreWindowState()
|
||||
{
|
||||
// restore the toolbar and dock widgets positions using Qt4 settings API
|
||||
QgsSettings settings;
|
||||
|
||||
#if 0
|
||||
// because of Qt regression: https://bugreports.qt.io/browse/QTBUG-89034
|
||||
// we have to wait till dialog is first shown to try to restore dock geometry or it's not correctly restored
|
||||
// so this code was moved to showEvent for now...
|
||||
if ( !restoreState( settings.value( QStringLiteral( "UI/state" ), QByteArray::fromRawData( reinterpret_cast< const char * >( defaultUIstate ), sizeof defaultUIstate ) ).toByteArray() ) )
|
||||
{
|
||||
QgsDebugMsg( QStringLiteral( "restore of UI state failed" ) );
|
||||
}
|
||||
#endif
|
||||
|
||||
if ( settings.value( QStringLiteral( "UI/hidebrowser" ), false ).toBool() )
|
||||
{
|
||||
@ -17150,3 +17154,19 @@ QgsAttributeEditorContext QgisApp::createAttributeEditorContext()
|
||||
context.setMainMessageBar( messageBar() );
|
||||
return context;
|
||||
}
|
||||
|
||||
void QgisApp::showEvent( QShowEvent *event )
|
||||
{
|
||||
QMainWindow::showEvent( event );
|
||||
// because of Qt regression: https://bugreports.qt.io/browse/QTBUG-89034
|
||||
// we have to wait till dialog is first shown to try to restore dock geometry or it's not correctly restored
|
||||
static std::once_flag firstShow;
|
||||
std::call_once( firstShow, [this]
|
||||
{
|
||||
QgsSettings settings;
|
||||
if ( !restoreState( settings.value( QStringLiteral( "UI/state" ), QByteArray::fromRawData( reinterpret_cast< const char * >( defaultUIstate ), sizeof defaultUIstate ) ).toByteArray() ) )
|
||||
{
|
||||
QgsDebugMsg( QStringLiteral( "restore of UI state failed" ) );
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@ -1274,6 +1274,7 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
|
||||
QgsAttributeEditorContext createAttributeEditorContext();
|
||||
|
||||
protected:
|
||||
void showEvent( QShowEvent *event ) override;
|
||||
|
||||
//! Handle state changes (WindowTitleChange)
|
||||
void changeEvent( QEvent *event ) override;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user