From 059902a40809d82c9b9625277bd282250ac343b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kotiuk?= Date: Sun, 12 Nov 2023 14:33:58 +0100 Subject: [PATCH 1/3] Fix deprecated QDesktopWidget::screenGeometry(int) https://doc.qt.io/qt-5/qdesktopwidget-obsolete.html#screenGeometry --- src/event.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/event.cpp b/src/event.cpp index 027f8ce63..c9415bea0 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -71,7 +72,7 @@ void fakeAbsMouseCoordinates(double springX, double springY, int width, int heig int destMidWidth = 0; int destMidHeight = 0; - QRect deskRect = PadderCommon::mouseHelperObj.getDesktopWidget()->screenGeometry(screen); + QRect deskRect = QGuiApplication::screens().at(screen)->geometry(); screenWidth = deskRect.width(); screenHeight = deskRect.height(); @@ -315,7 +316,7 @@ void sendSpringEvent(PadderCommon::springModeInfo *fullSpring, PadderCommon::spr fullSpring->screen = -1; } - QRect deskRect = PadderCommon::mouseHelperObj.getDesktopWidget()->screenGeometry(fullSpring->screen); + QRect deskRect = QGuiApplication::screens().at(fullSpring->screen)->geometry(); width = deskRect.width(); height = deskRect.height(); From 66298b5fbf5199d25880f88950d79da468ab0168 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kotiuk?= Date: Sun, 12 Nov 2023 14:35:36 +0100 Subject: [PATCH 2/3] Fix deprecation warning for QWheelEvent::delta() https://doc.qt.io/archives/qt-5.5/qwheelevent-obsolete.html#orientation --- src/simplekeygrabberbutton.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/simplekeygrabberbutton.cpp b/src/simplekeygrabberbutton.cpp index 18695d833..b3aa1846b 100644 --- a/src/simplekeygrabberbutton.cpp +++ b/src/simplekeygrabberbutton.cpp @@ -192,16 +192,16 @@ bool SimpleKeyGrabberButton::eventFilter(QObject *obj, QEvent *event) QWheelEvent *wheelEve = static_cast(event); QString text = QString(tr("Mouse")).append(" "); - if ((wheelEve->orientation() == Qt::Vertical) && (wheelEve->delta() >= 120)) + if ((wheelEve->angleDelta().y() >= 120)) { controlcode = 4; - } else if ((wheelEve->orientation() == Qt::Vertical) && (wheelEve->delta() <= -120)) + } else if ((wheelEve->angleDelta().y() <= -120)) { controlcode = 5; - } else if ((wheelEve->orientation() == Qt::Horizontal) && (wheelEve->delta() >= 120)) + } else if ((wheelEve->angleDelta().x() >= 120)) { controlcode = 6; - } else if ((wheelEve->orientation() == Qt::Horizontal) && (wheelEve->delta() <= -120)) + } else if ((wheelEve->angleDelta().x() <= -120)) { controlcode = 7; } From 52f7751d1da5235b8dde385a9e64fc0459a0817c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Kotiuk?= Date: Sun, 12 Nov 2023 14:50:54 +0100 Subject: [PATCH 3/3] Fix deprecated QString::SkipEmptyParts https://doc.qt.io/qt-5/qstring-obsolete.html#split-4 --- src/common.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/common.cpp b/src/common.cpp index c0ab85f0f..55b497bfc 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -88,7 +88,11 @@ QStringList arguments(const int &argc, char **argv) QStringList parseArgumentsString(QString tempString) { bool inside = (!tempString.isEmpty() && tempString.at(0) == QChar('"')); +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + QStringList tempList = tempString.split(QRegExp("\""), Qt::SkipEmptyParts); +#else QStringList tempList = tempString.split(QRegExp("\""), QString::SkipEmptyParts); +#endif QStringList finalList = QStringList(); QStringListIterator iter(tempList); @@ -99,8 +103,11 @@ QStringList parseArgumentsString(QString tempString) if (inside) finalList.append(temp); else +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + finalList.append(temp.split(QRegExp("\\s+"), Qt::SkipEmptyParts)); +#else finalList.append(temp.split(QRegExp("\\s+"), QString::SkipEmptyParts)); - +#endif inside = !inside; } @@ -120,7 +127,7 @@ void reloadTranslations(QTranslator *translator, QTranslator *appTranslator, QSt // Remove old Qt translation strings qApp->removeTranslator(appTranslator); - // Load new Qt translation strings +// Load new Qt translation strings #if defined(Q_OS_UNIX) translator->load(QString("qt_").append(language), QLibraryInfo::location(QLibraryInfo::TranslationsPath)); #elif defined(Q_OS_WIN) @@ -134,7 +141,7 @@ void reloadTranslations(QTranslator *translator, QTranslator *appTranslator, QSt qApp->installTranslator(appTranslator); - // Load application specific translation strings +// Load application specific translation strings #if defined(Q_OS_UNIX) translator->load("antimicrox_" + language, QApplication::applicationDirPath().append("/../share/antimicrox/translations"));