Qt5: QDesktopWidget is deprecated use QScreen [-Wdeprecated-declarations]

This commit is contained in:
wmayer
2020-06-11 02:21:57 +02:00
committed by wwmayer
parent deb39c4321
commit eced0cb568
6 changed files with 48 additions and 0 deletions

View File

@@ -64,6 +64,10 @@
#include <QtGui/QMouseEvent>
#include <math.h>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
# include <QScreen>
#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())

View File

@@ -71,6 +71,10 @@
# define QWEBPAGE QWebPage
#endif
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
# include <QScreen>
#endif
#include <QLatin1String>
#include <QRegExp>
#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);
}