Disable incompatable shortcuts for Qt6

This commit is contained in:
Ximi1970
2024-03-31 22:37:06 +02:00
parent cd9242c88b
commit 4c0bc46dd0
4 changed files with 76 additions and 19 deletions

View File

@@ -22,9 +22,19 @@ include( ../SysTray-X.pri )
QT += core gui
unix:!macx: {
contains(DEFINES,KDE_INTEGRATION) {
QT += dbus KNotifications
lessThan(QT_MAJOR_VERSION, 6): {
QT += dbus KNotifications
}
else
{
INCLUDEPATH += /usr/include/KF6/KStatusNotifierItem
LIBS += -lKF6StatusNotifierItem
}
}
lessThan(QT_MAJOR_VERSION, 6): {
QT += x11extras
}
QT += x11extras
}
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
@@ -152,8 +162,6 @@ win32: {
SOURCES += \
main.cpp \
nativeeventfilterbase.cpp \
shortcut.cpp \
systrayxlink.cpp \
systrayxicon.cpp \
systrayx.cpp \
@@ -161,25 +169,39 @@ SOURCES += \
preferencesdialog.cpp \
preferences.cpp \
windowctrl.cpp
lessThan(QT_MAJOR_VERSION, 6): {
SOURCES += \
shortcut.cpp \
nativeeventfilterbase.cpp
}
unix: {
SOURCES += \
nativeeventfilter-x11.cpp \
windowctrl-unix.cpp
SOURCES += \
windowctrl-unix.cpp
contains(DEFINES,KDE_INTEGRATION) {
SOURCES += \
systrayxstatusnotifier.cpp
}
lessThan(QT_MAJOR_VERSION, 6): {
SOURCES += \
nativeeventfilter-x11.cpp
}
}
win32: {
SOURCES += \
nativeeventfilter-win.cpp \
windowctrl-win.cpp
lessThan(QT_MAJOR_VERSION, 6): {
SOURCES += \
nativeeventfilter-win.cpp
}
}
HEADERS += \
debug.h \
nativeeventfilterbase.h \
shortcut.h \
systrayxlink.h \
systrayxicon.h \
systrayx.h \
@@ -187,20 +209,35 @@ HEADERS += \
preferencesdialog.h \
preferences.h \
windowctrl.h
lessThan(QT_MAJOR_VERSION, 6): {
HEADERS += \
shortcut.h \
nativeeventfilterbase.h
}
unix: {
HEADERS += \
nativeeventfilter-x11.h \
HEADERS += \
windowctrl-unix.h
contains(DEFINES,KDE_INTEGRATION) {
HEADERS += \
systrayxstatusnotifier.h
}
lessThan(QT_MAJOR_VERSION, 6): {
HEADERS += \
nativeeventfilter-x11.h
}
}
win32: {
HEADERS += \
nativeeventfilter-win.h \
HEADERS += \
windowctrl-win.h
lessThan(QT_MAJOR_VERSION, 6): {
HEADERS += \
nativeeventfilter-win.h
}
}
FORMS += \

View File

@@ -9,7 +9,9 @@
/*
* Qt includes
*/
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QX11Info>
#endif
#include <QKeySequence>
@@ -127,7 +129,11 @@ bool NativeEventFilterX11::connectShortcut( Qt::Key key_code, Qt::KeyboardModifi
/*
* Get the X11 display
*/
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Display *display = QX11Info::display();
#else
Display *display = 0;
#endif
/*
* Get the final key code
@@ -153,7 +159,11 @@ bool NativeEventFilterX11::connectShortcut( Qt::Key key_code, Qt::KeyboardModifi
*/
bool NativeEventFilterX11::disconnectShortcut()
{
Display* display = QX11Info::display();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
Display *display = QX11Info::display();
#else
Display *display = 0;
#endif
/*
* Ungrab the key

View File

@@ -1087,6 +1087,7 @@ void PreferencesDialog::slotTruncateShowHideShortcut()
{
QKeySequence key_seq = m_ui->showHideKeySequenceEdit->keySequence();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
/*
* Workaround for a Qt5 bug in QKeySequenceEdit object, Meta/Win key is not handled correctly.
*/
@@ -1101,6 +1102,13 @@ void PreferencesDialog::slotTruncateShowHideShortcut()
}
QKeySequence shortcut( value );
#else
QKeySequence shortcut( key_seq[ 0 ] );
#endif
m_ui->showHideKeySequenceEdit->setKeySequence( shortcut );
}

View File

@@ -9,7 +9,7 @@
#include "systrayxicon.h"
#include "systrayxstatusnotifier.h"
#include "windowctrl.h"
#include "shortcut.h"
//#include "shortcut.h"
/*
* Qt includes
@@ -189,7 +189,7 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
m_preferences->displayDebug();
/*
m_preferences->setBrowserVersion( "115.1.0" );
// m_preferences->setBrowserVersion( "102.2.3" );
m_preferences->setShowHideShortcut( QKeySequence( Qt::CTRL | Qt::Key_P ) );
@@ -206,7 +206,7 @@ SysTrayX::SysTrayX( QObject *parent ) : QObject( parent )
// m_preferences->setStartApp( "/home/maxime/test.sh" );
// m_preferences->setStartAppArgs( "/home/maxime/startup.txt StartupString" );
// slotStartApp();
*/
}
@@ -726,7 +726,7 @@ void SysTrayX::slotLoadLanguage( QString locale )
}
QString locale_path = "SysTray-X."+ locale;
m_translator.load( locale_path, ":/languages/" );
(void)m_translator.load( locale_path, ":/languages/" );
// bool status = m_translator.load( locale_path, ":/languages/" );
// emit signalConsole( QString( "Language loaded %1").arg(status));
qApp->installTranslator( &m_translator );
@@ -775,6 +775,7 @@ void SysTrayX::slotCloseApp()
void SysTrayX::slotShowHideShortcutChange()
{
#ifdef ENABLE_SHORTCUT
if( m_show_hide_shortcut != nullptr )
{
disconnect( m_show_hide_shortcut, &Shortcut::activated, m_win_ctrl, &WindowCtrl::slotShowHide );
@@ -785,4 +786,5 @@ void SysTrayX::slotShowHideShortcutChange()
m_show_hide_shortcut = new Shortcut( m_preferences->getShowHideShortcut(), this );
connect( m_show_hide_shortcut, &Shortcut::activated, m_win_ctrl, &WindowCtrl::slotShowHide );
#endif
}