diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index a75bf5df68..5d0ea6a90f 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -37,6 +37,10 @@ # include #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +#endif + #include #include "Action.h" #include "Application.h" @@ -420,7 +424,11 @@ void WorkbenchComboBox::showPopup() int rows = count(); if (rows > 0) { int height = view()->sizeHintForRow(0); +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + int maxHeight = QApplication::primaryScreen()->size().height(); +#else int maxHeight = QApplication::desktop()->height(); +#endif view()->setMinimumHeight(qMin(height * rows, maxHeight/2)); } diff --git a/src/Gui/DlgPreferencesImp.cpp b/src/Gui/DlgPreferencesImp.cpp index 260ed4132e..f327cd7740 100644 --- a/src/Gui/DlgPreferencesImp.cpp +++ b/src/Gui/DlgPreferencesImp.cpp @@ -34,6 +34,10 @@ # include #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +#endif + #include #include #include @@ -307,7 +311,11 @@ void DlgPreferencesImp::resizeEvent(QResizeEvent* ev) if (canEmbedScrollArea) { // embed the widget stack into a scroll area if the size is // bigger than the available desktop +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QRect rect = QApplication::primaryScreen()->availableGeometry(); +#else QRect rect = QApplication::desktop()->availableGeometry(); +#endif int maxHeight = rect.height() - 60; int maxWidth = rect.width(); if (height() > maxHeight || width() > maxWidth) { diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index d463acd077..458993b560 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -53,6 +53,10 @@ # include #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +#endif + // FreeCAD Base header #include #include @@ -1409,7 +1413,11 @@ void MainWindow::loadWindowSettings() QString qtver = QString::fromLatin1("Qt%1.%2").arg(major).arg(minor); QSettings config(vendor, application); +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QRect rect = QApplication::primaryScreen()->availableGeometry(); +#else QRect rect = QApplication::desktop()->availableGeometry(); +#endif int maxHeight = rect.height(); int maxWidth = rect.width(); diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index d3e04ba27b..66efe4df49 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -44,6 +44,10 @@ # include #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +#endif + #include #include #include @@ -234,7 +238,11 @@ AboutDialog::AboutDialog(bool showLic, QWidget* parent) setModal(true); ui->setupUi(this); +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QRect rect = QApplication::primaryScreen()->availableGeometry(); +#else QRect rect = QApplication::desktop()->availableGeometry(); +#endif QPixmap image = getMainWindow()->splashImage(); // Make sure the image is not too big diff --git a/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp b/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp index 584f0ce2a8..0d2db3db0b 100644 --- a/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp +++ b/src/Mod/Spreadsheet/Gui/qtcolorpicker.cpp @@ -64,6 +64,10 @@ #include #include +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +#endif + #include "qtcolorpicker.h" /*! \class QtColorPicker @@ -312,7 +316,11 @@ void QtColorPicker::buttonPressed(bool toggled) if (!toggled) return; +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + const QRect desktop = QApplication::primaryScreen()->geometry(); +#else const QRect desktop = QApplication::desktop()->geometry(); +#endif // Make sure the popup is inside the desktop. QPoint pos = mapToGlobal(rect().bottomLeft()); if (pos.x() < desktop.left()) diff --git a/src/Mod/Web/Gui/BrowserView.cpp b/src/Mod/Web/Gui/BrowserView.cpp index fc7c860336..e649f799ec 100644 --- a/src/Mod/Web/Gui/BrowserView.cpp +++ b/src/Mod/Web/Gui/BrowserView.cpp @@ -71,6 +71,10 @@ # define QWEBPAGE QWebPage #endif +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) +# include +#endif + #include #include #include "BrowserView.h" @@ -239,7 +243,11 @@ WebView::WebView(QWidget *parent) : QWEBVIEW(parent) { // Increase html font size for high DPI displays +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + QRect mainScreenSize = QApplication::primaryScreen()->geometry(); +#else QRect mainScreenSize = QApplication::desktop()->screenGeometry(); +#endif if (mainScreenSize.width() > 1920){ setTextSizeMultiplier (mainScreenSize.width()/1920.0); }