Use QWidget::screen() with Qt 5.14

This commit is contained in:
Jonas Kvinge 2020-01-05 19:15:28 +01:00
parent aa255aa7e6
commit 3cdc8dc4b6
1 changed files with 7 additions and 3 deletions

View File

@ -21,8 +21,8 @@
#include "config.h" #include "config.h"
#include <QDialog> #include <QDialog>
#include <QWindow>
#include <QScreen> #include <QScreen>
#include <QWindow>
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QAbstractItemView> #include <QAbstractItemView>
#include <QTreeWidget> #include <QTreeWidget>
@ -283,8 +283,12 @@ void SettingsDialog::showEvent(QShowEvent *e) {
loading_settings_ = false; loading_settings_ = false;
// Resize the dialog if it's too big // Resize the dialog if it's too big
const QRect available = window()->windowHandle()->screen()->geometry(); #if (QT_VERSION >= QT_VERSION_CHECK(5, 14, 0))
if (available.height() < height()) { 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()); resize(width(), sizeHint().height());
} }