Skip to content

Commit

Permalink
Fixed #418 - Windows State/Size does not save in case of fullscreen (2)
Browse files Browse the repository at this point in the history
QApplication::desktop is obsoleted and QT6.x does not implement it.
This commit uses QGuiApplication::screens
  • Loading branch information
foldynl committed Jul 23, 2024
1 parent a7ed96c commit 75c4f70
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions ui/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -573,15 +573,21 @@ void MainWindow::setLayoutGeometry()
{
restoreGeometry(layoutProfile.mainGeometry);
if ( isMaximized() )
setGeometry( QApplication::desktop()->availableGeometry( this ) );
{
const QList<QScreen *> &screens = QGuiApplication::screens();
setGeometry( screens[0]->availableGeometry() );
}
restoreState(layoutProfile.mainState);
darkLightModeSwith->setChecked(layoutProfile.darkMode);
}
else
{
restoreGeometry(settings.value("geometry").toByteArray());
if ( isMaximized() )
setGeometry( QApplication::desktop()->availableGeometry( this ) );
{
const QList<QScreen *> &screens = QGuiApplication::screens();
setGeometry( screens[0]->availableGeometry() );
}
restoreState(settings.value("windowState").toByteArray());
// leave dark mode as is
}
Expand Down Expand Up @@ -699,6 +705,11 @@ void MainWindow::setupLayoutMenu()
|| layoutProfile.mainState != QByteArray() )
{
restoreGeometry(layoutProfile.mainGeometry);
if ( isMaximized() )
{
const QList<QScreen *> &screens = QGuiApplication::screens();
setGeometry( screens[0]->availableGeometry() );
}
restoreState(layoutProfile.mainState);
darkLightModeSwith->setChecked(isFusionStyle && layoutProfile.darkMode);
}
Expand Down

0 comments on commit 75c4f70

Please sign in to comment.