mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Merge pull request #1049 from shenlebantongying/fix_restores
fix: adjust the order of Mainwindow's show() and restoreState/restoreGeometry
This commit is contained in:
commit
fd42f877f4
|
@ -769,7 +769,19 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
view->showDefinition( tr( "Welcome!" ), Instances::Group::HelpGroupId );
|
||||
history.enableAdd( cfg.preferences.storeHistory );
|
||||
|
||||
translateLine->setFocus();
|
||||
// restore should be called after all UI initialized but not necessarily after show()
|
||||
// This must be called before show() as of Qt6.5 on Windows, not sure if it is a bug
|
||||
// Due to a bug of WebEngine, this also must be called after WebEngine has a view loaded https://bugreports.qt.io/browse/QTBUG-115074
|
||||
if ( cfg.mainWindowState.size() && !cfg.resetState )
|
||||
restoreState( cfg.mainWindowState );
|
||||
if ( cfg.mainWindowGeometry.size() )
|
||||
restoreGeometry( cfg.mainWindowGeometry );
|
||||
|
||||
// Show window unless it is configured not to
|
||||
if ( !cfg.preferences.enableTrayIcon || !cfg.preferences.startToTray ) {
|
||||
show();
|
||||
focusTranslateLine();
|
||||
}
|
||||
|
||||
// Scanpopup related
|
||||
scanPopup =
|
||||
|
@ -860,12 +872,6 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
on_alwaysOnTop_triggered( true );
|
||||
}
|
||||
|
||||
// Only show window initially if it wasn't configured differently
|
||||
if ( !cfg.preferences.enableTrayIcon || !cfg.preferences.startToTray ) {
|
||||
show();
|
||||
focusTranslateLine();
|
||||
}
|
||||
|
||||
if ( cfg.preferences.hideMenubar ) {
|
||||
toggleMenuBarTriggered( false );
|
||||
}
|
||||
|
@ -911,12 +917,6 @@ MainWindow::MainWindow( Config::Class & cfg_ ):
|
|||
urlRegistry.endGroup();
|
||||
#endif
|
||||
|
||||
// restore should be called after all UI initialized.
|
||||
if ( cfg.mainWindowState.size() && !cfg.resetState )
|
||||
restoreState( cfg.mainWindowState );
|
||||
if ( cfg.mainWindowGeometry.size() )
|
||||
restoreGeometry( cfg.mainWindowGeometry );
|
||||
|
||||
useSmallIconsInToolbarsTriggered();
|
||||
|
||||
if ( cfg.preferences.checkForNewReleases ) {
|
||||
|
|
Loading…
Reference in a new issue