Drop Qt 5 support

Qt 6 has been available for almost 4 years. Qt 5 is no longer officially supported by Qt for opensource, it's time to drop Qt 5.
This commit is contained in:
Jonas Kvinge
2024-09-07 00:12:56 +02:00
parent eb30c654c5
commit e3e6a22172
91 changed files with 76 additions and 760 deletions

View File

@@ -91,11 +91,7 @@ bool GlobalShortcut::unregisterShortcut(const int native_key, const int native_m
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, qintptr *result) {
#else
bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, long *result) {
#endif
Q_UNUSED(eventtype);
Q_UNUSED(result);

View File

@@ -170,11 +170,7 @@ bool GlobalShortcut::unregisterShortcut(const int native_key, const int native_m
}
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, qintptr *result) {
#else
bool GlobalShortcut::nativeEventFilter(const QByteArray &eventtype, void *message, long *result) {
#endif
Q_UNUSED(eventtype);
Q_UNUSED(result);

View File

@@ -26,9 +26,7 @@
#include <QHash>
#include <QFlags>
#include <QKeySequence>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
# include <QKeyCombination>
#endif
#include <QKeyCombination>
#include "core/logging.h"
@@ -85,15 +83,9 @@ bool GlobalShortcut::setShortcut(const QKeySequence &shortcut) {
if (shortcut.isEmpty()) return false;
shortcut_ = shortcut;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QKeyCombination key_combination(shortcut[0]);
const QKeyCombination key_combination = shortcut[0];
qt_key_ = key_combination.key();
qt_mods_ = key_combination.keyboardModifiers();
#else
Qt::KeyboardModifiers all_mods = Qt::ShiftModifier | Qt::ControlModifier | Qt::AltModifier | Qt::MetaModifier;
qt_key_ = Qt::Key((shortcut[0] ^ all_mods) & shortcut[0]);
qt_mods_ = Qt::KeyboardModifiers(shortcut[0] & all_mods);
#endif
native_key_ = nativeKeycode(qt_key_.value());
if (native_key_ == 0) return false;

View File

@@ -64,11 +64,7 @@ class GlobalShortcut : public QObject, QAbstractNativeEventFilter {
static bool registerShortcut(const int native_key, const int native_mods);
static bool unregisterShortcut(const int native_key, const int native_mods);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
bool nativeEventFilter(const QByteArray &eventtype, void *message, qintptr *result) override;
#else
bool nativeEventFilter(const QByteArray &eventtype, void *message, long *result) override;
#endif
static GlobalShortcut *initialized_;
static QHash<QPair<quint32, quint32>, GlobalShortcut*> internal_shortcuts_;

View File

@@ -29,9 +29,7 @@
#include <QDBusObjectPath>
#include <QDBusPendingCallWatcher>
#include <QKeySequence>
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
# include <QKeyCombination>
#endif
#include <QKeyCombination>
#include "core/logging.h"
@@ -190,11 +188,7 @@ QList<int> GlobalShortcutsBackendKDE::ToIntList(const QList<QKeySequence> &seque
QList<int> ret;
ret.reserve(sequence_list.count());
for (const QKeySequence &sequence : sequence_list) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
ret.append(sequence[0].toCombined());
#else
ret.append(sequence[0]);
#endif
}
return ret;