diff --git a/src/settings/settingsdialog.cpp b/src/settings/settingsdialog.cpp index ed492356d..8b7256a4d 100644 --- a/src/settings/settingsdialog.cpp +++ b/src/settings/settingsdialog.cpp @@ -21,8 +21,8 @@ #include "config.h" #include -#include #include +#include #include #include #include @@ -283,8 +283,12 @@ void SettingsDialog::showEvent(QShowEvent *e) { loading_settings_ = false; // Resize the dialog if it's too big - const QRect available = window()->windowHandle()->screen()->geometry(); - if (available.height() < height()) { +#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->availableGeometry().height() < height()) { resize(width(), sizeHint().height()); }