From 2098ce90d01f0644d15bcce2e5b5c5c268bc55ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Niels=20Martign=C3=A8ne?= Date: Tue, 2 Nov 2021 11:45:04 +0100 Subject: [PATCH] Fix a bunch of minor Qt deprecations --- src/tycommander/arduino_dialog.cc | 6 ++++-- src/tycommander/enhanced_widgets.cc | 4 ++-- src/tycommander/session_channel.cc | 7 +++++-- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/tycommander/arduino_dialog.cc b/src/tycommander/arduino_dialog.cc index 0e292350..e6fb40bb 100644 --- a/src/tycommander/arduino_dialog.cc +++ b/src/tycommander/arduino_dialog.cc @@ -13,7 +13,7 @@ #endif #include #include -#include +#include #include #include "arduino_dialog.hpp" @@ -152,7 +152,9 @@ void ArduinoDialog::appendMessage(const QString &msg, const QTextCharFormat &fmt void ArduinoDialog::executeAsRoot(const QString &command) { #ifdef _WIN32 - if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) { + auto vista = QOperatingSystemVersion(QOperatingSystemVersion::Windows, 6, 0); + + if (QOperatingSystemVersion::current() >= vista) { installWithUAC(command); return; } diff --git a/src/tycommander/enhanced_widgets.cc b/src/tycommander/enhanced_widgets.cc index 9cdb45b5..4cf73a75 100644 --- a/src/tycommander/enhanced_widgets.cc +++ b/src/tycommander/enhanced_widgets.cc @@ -139,9 +139,9 @@ void EnhancedLineInput::keyPressEvent(QKeyEvent *ev) void EnhancedLineInput::wheelEvent(QWheelEvent *ev) { - if (ev->delta() > 0) { + if (ev->angleDelta().y() > 0) { moveInHistory(-1); - } else if (ev->delta() < 0) { + } else if (ev->angleDelta().y() < 0) { moveInHistory(1); } } diff --git a/src/tycommander/session_channel.cc b/src/tycommander/session_channel.cc index 80403d21..bc46f42e 100644 --- a/src/tycommander/session_channel.cc +++ b/src/tycommander/session_channel.cc @@ -202,8 +202,11 @@ SessionPeer::SessionPeer(QLocalSocket *socket) QObject::connect(socket, &QLocalSocket::disconnected, this, [=]() { close(RemoteClose); }); - QObject::connect(socket, static_cast(&QLocalSocket::error), - this, [=]() { +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0) + QObject::connect(socket, &QLocalSocket::errorOccurred, this, [=]() { +#else + QObject::connect(socket, static_cast(&QLocalSocket::error), this, [=]() { +#endif close(Error); }); }