From b10340c39456b37fac285f54dd6736d734db0c5c Mon Sep 17 00:00:00 2001 From: Nodir Temirkhodjaev Date: Wed, 7 Apr 2021 11:21:23 +0300 Subject: [PATCH] UI: Fix build for Qt 5. --- src/3rdparty/qcustomplot/qcustomplot.h | 2 ++ src/ui/form/opt/pages/mainpage.cpp | 2 ++ src/ui/util/hotkeymanager.cpp | 9 ++++++++- 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/3rdparty/qcustomplot/qcustomplot.h b/src/3rdparty/qcustomplot/qcustomplot.h index bfbc8009..bab4e0e1 100644 --- a/src/3rdparty/qcustomplot/qcustomplot.h +++ b/src/3rdparty/qcustomplot/qcustomplot.h @@ -164,7 +164,9 @@ class QCP { // when in moc-run, make it look like a class, so we get Q_GADGET, Q Q_ENUMS(SelectionRectMode) Q_ENUMS(SelectionType) public: +#endif +#if QT_VERSION < QT_VERSION_CHECK(6, 2, 0) extern const QMetaObject staticMetaObject; // in moc-run we create a static meta object for QCP "fake" object. This line is the link to it via QCP::staticMetaObject in normal operation as namespace #endif diff --git a/src/ui/form/opt/pages/mainpage.cpp b/src/ui/form/opt/pages/mainpage.cpp index b38305b5..3d004aee 100644 --- a/src/ui/form/opt/pages/mainpage.cpp +++ b/src/ui/form/opt/pages/mainpage.cpp @@ -75,7 +75,9 @@ void MainPage::setupTabBar() m_tabBar->addTab(statisticsPage, IconCache::icon(":/icons/database.png"), QString()); m_tabBar->addTab(schedulePage, IconCache::icon(":/icons/clock.png"), QString()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) m_tabBar->setTabVisible(2, false); // TODO: Impl. Network Rules +#endif } QLayout *MainPage::setupDialogButtons() diff --git a/src/ui/util/hotkeymanager.cpp b/src/ui/util/hotkeymanager.cpp index c5a7a217..6c8d27ae 100644 --- a/src/ui/util/hotkeymanager.cpp +++ b/src/ui/util/hotkeymanager.cpp @@ -16,7 +16,14 @@ bool HotKeyManager::addAction(QAction *action, const QKeySequence &shortcut) { const int hotKeyId = m_actions.size(); - if (!m_nativeEventFilter->registerHotKey(hotKeyId, shortcut[0])) + const auto keyCombination = shortcut[0]; +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + const int key = keyCombination; +#else + const int key = keyCombination.toCombined(); +#endif + + if (!m_nativeEventFilter->registerHotKey(hotKeyId, key)) return false; action->setText(action->text() + '\t' + shortcut.toString());