Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Store / load states only if the Qt version matches #557

Merged
merged 1 commit into from
Jan 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions YUViewLib/src/ui/Mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ MainWindow::MainWindow(bool useAlternativeSources, QWidget *parent) : QMainWindo
{
// load geometry and active dockable widgets from user preferences
restoreGeometry(settings.value("mainWindow/geometry").toByteArray());
restoreState(settings.value("mainWindow/windowState").toByteArray());
restoreState(settings.value("mainWindow/windowState").toByteArray(), QT_VERSION);
separateViewWindow.restoreGeometry(settings.value("separateViewWindow/geometry").toByteArray());
separateViewWindow.restoreState(settings.value("separateViewWindow/windowState").toByteArray());
separateViewWindow.restoreState(settings.value("separateViewWindow/windowState").toByteArray(), QT_VERSION);
}

connect(ui.openButton, &QPushButton::clicked, this, &MainWindow::showFileOpenDialog);
Expand Down Expand Up @@ -413,7 +413,7 @@ void MainWindow::createMenusAndActions()
&PlaybackController::previousFrame,
Qt::Key_Left);

auto addLambdaActionToMenu = [this](QMenu *menu, QString name, auto lambda) {
auto addLambdaActionToMenu = [](QMenu *menu, const QString name, auto lambda) {
auto action = new QAction(name, menu);
QObject::connect(action, &QAction::triggered, lambda);
menu->addAction(action);
Expand Down Expand Up @@ -511,9 +511,9 @@ void MainWindow::closeEvent(QCloseEvent *event)
// Do not save the window state if we just cleared the settings
QSettings settings;
settings.setValue("mainWindow/geometry", saveGeometry());
settings.setValue("mainWindow/windowState", saveState());
settings.setValue("mainWindow/windowState", saveState(QT_VERSION));
settings.setValue("separateViewWindow/geometry", separateViewWindow.saveGeometry());
settings.setValue("separateViewWindow/windowState", separateViewWindow.saveState());
settings.setValue("separateViewWindow/windowState", separateViewWindow.saveState(QT_VERSION));
}

// Delete all items in the playlist. This will also kill all eventual running background
Expand Down Expand Up @@ -932,7 +932,7 @@ void MainWindow::resetWindowLayout()
separateViewWindow.setGeometry(0, 0, 500, 300);
separateViewWindow.move(0, 0);
settings.setValue("separateViewWindow/geometry", separateViewWindow.saveGeometry());
settings.setValue("separateViewWindow/windowState", separateViewWindow.saveState());
settings.setValue("separateViewWindow/windowState", separateViewWindow.saveState(QT_VERSION));

// Dock all dock panels
ui.playlistDockWidget->setFloating(false);
Expand Down Expand Up @@ -966,7 +966,7 @@ void MainWindow::resetWindowLayout()

// Save main window state (including the layout of the dock widgets)
settings.setValue("mainWindow/geometry", saveGeometry());
settings.setValue("mainWindow/windowState", saveState());
settings.setValue("mainWindow/windowState", saveState(QT_VERSION));

// Reset the split view
ui.displaySplitView->resetView(false);
Expand Down