Skip to content

Commit

Permalink
chore: Fix deprecation warnings for Qt #863
Browse files Browse the repository at this point in the history
  • Loading branch information
pktiuk authored Nov 12, 2023
2 parents 4b73895 + 52f7751 commit b73f7e1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 9 deletions.
13 changes: 10 additions & 3 deletions src/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
}

Expand All @@ -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)
Expand All @@ -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"));
Expand Down
5 changes: 3 additions & 2 deletions src/event.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#include <QFileInfo>
#include <QMessageBox>
#include <QProcess>
#include <QScreen>
#include <QStringList>
#include <QVariant>
#include <cmath>
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/simplekeygrabberbutton.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,16 @@ bool SimpleKeyGrabberButton::eventFilter(QObject *obj, QEvent *event)
QWheelEvent *wheelEve = static_cast<QWheelEvent *>(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;
}
Expand Down

0 comments on commit b73f7e1

Please sign in to comment.