From 5a3edc00accdc0fc4c59ae33728379a657310f29 Mon Sep 17 00:00:00 2001 From: Jonas Kvinge Date: Mon, 6 Apr 2020 23:14:23 +0200 Subject: [PATCH] Remove extra check for oversized window --- src/covermanager/albumcovermanager.cpp | 16 +++------------- src/settings/settingsdialog.cpp | 16 +++------------- 2 files changed, 6 insertions(+), 26 deletions(-) diff --git a/src/covermanager/albumcovermanager.cpp b/src/covermanager/albumcovermanager.cpp index 5275f6840..32cc70716 100644 --- a/src/covermanager/albumcovermanager.cpp +++ b/src/covermanager/albumcovermanager.cpp @@ -267,21 +267,11 @@ void AlbumCoverManager::LoadGeometry() { } s.endGroup(); - // Resize the window if it's too big -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) - QScreen *screen = QWidget::screen(); -#else - QScreen *screen = (window() && window()->windowHandle() ? window()->windowHandle()->screen() : QGuiApplication::primaryScreen()); -#endif - if (screen && screen->availableGeometry().height() < height()) { - resize(width(), sizeHint().height()); - } - // Center the window on the same screen as the mainwindow. -#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) - screen = mainwindow_->screen(); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + QScreen *screen = mainwindow_->screen(); #else - screen = (mainwindow_->window() && mainwindow_->window()->windowHandle() ? mainwindow_->window()->windowHandle()->screen() : nullptr); + QScreen *screen = (mainwindow_->window() && mainwindow_->window()->windowHandle() ? mainwindow_->window()->windowHandle()->screen() : nullptr); #endif if (screen) { const QRect sr = screen->availableGeometry(); diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index e2c1c85d7..84d04bc20 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -219,21 +219,11 @@ void SettingsDialog::LoadGeometry() { } s.endGroup(); - // Resize the dialog if it's too big -#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) - QScreen *screen = QWidget::screen(); -#else - QScreen *screen = (window() && window()->windowHandle() ? window()->windowHandle()->screen() : QGuiApplication::primaryScreen()); -#endif - if (screen && screen->availableGeometry().height() < height()) { - resize(width(), sizeHint().height()); - } - // Center the dialog on the same screen as mainwindow. -#if (QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)) - screen = mainwindow_->screen(); +#if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)) + QScreen *screen = mainwindow_->screen(); #else - screen = (mainwindow_->window() && mainwindow_->window()->windowHandle() ? mainwindow_->window()->windowHandle()->screen() : nullptr); + QScreen *screen = (mainwindow_->window() && mainwindow_->window()->windowHandle() ? mainwindow_->window()->windowHandle()->screen() : nullptr); #endif if (screen) { const QRect sr = screen->availableGeometry();