Remove extra check for oversized window

This commit is contained in:
Jonas Kvinge 2020-04-06 23:14:23 +02:00
parent 5a5f50e1e4
commit 5a3edc00ac
2 changed files with 6 additions and 26 deletions

View File

@ -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();

View File

@ -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();