26 Commits
Author SHA1 Message Date
Orgad Shaneh 4e3a244d87 Raise minimmum cmake version to 3.10 (#108)
Older versions are obsolete.
2025-10-01 01:28:08 +03:00
Orgad Shaneh d7b2589855 README: Fix typo (#107) 2025-10-01 00:58:35 +03:00
Daniel Bermond 6c0e98492c Add compatibility with QT_NO_KEYWORDS macro (#104)
The Qt documentation recommends[1] not using Qt keywords in the
public API of Qt libraries, specially the 'signals' and 'slots'
Qt keywords.

Without this, client applications that are compiled with the
'QT_NO_KEYWORDS'[2] macro (or that are compiled in conjunction
with other libraries that also defines the same Qt keywords)
will fail to build.

The 'QT_NO_SIGNALS_SLOTS_KEYWORDS'[1] macro assures that
the library is not using 'signals' and 'slots' Qt keywords,
since it will fail to build when they are used. Useful for
code sanity and for avoiding future pull requests that may
try to use these Qt keywords.

[1] https://doc.qt.io/qt-6/signalsandslots.html#signals-and-slots-in-qt-based-libraries
[2] https://doc.qt.io/qt-6/qtglobal.html#QT_NO_KEYWORDS
2025-07-06 13:48:54 +03:00
Daniel Bermond 8f90bdf90c Add compatibility with CMake 4.0 (#103)
Starting at CMake 4.0, the minimum required policy version is
3.5.0[1], either specified by 'cmake_minimum_required()' or by
'cmake_policy()'. This also applies to individual policies when
they are set, which must match 3.5.0 or later policies.

[1] https://cmake.org/cmake/help/v4.0/command/cmake_minimum_required.html
2025-07-06 13:48:05 +03:00
Javier O. Cordero Pérez bb63025268 Fix: Prevent crash on Wayland when using Qt 6 (#97) 2024-05-20 22:13:12 +03:00
Javier O. Cordero Pérez b519155479 Bump Qt and CI script versions, fix macOS support, and drop support for qmake (#98) 2024-05-20 16:09:14 +03:00
FredBill1andHennadii Chernyshchyk cd72a01327 Properly emit released signal when pressing multiple hotkeys at the same time on Windows (#86)
Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com>
2023-04-18 12:14:52 +03:00
Javier O. Cordero PérezandHennadii Chernyshchyk 34777f2e91 CPack instructions to build Debian package
Co-authored-by: Hennadii Chernyshchyk <genaloner@gmail.com>
2022-07-07 16:01:21 +03:00
Javier O. Cordero 94efd5fb61 Using static_cast as suggested by Shatur. 2022-07-01 10:52:16 +03:00
Javier O. Cordero Pérez 6b1c6f1f4e Made Windows BYTE typedef uppercase in attempt to get QHotkey to compile with MSVC 2019. 2022-07-01 10:52:16 +03:00
luz paz c501fbbada Fix typos
Found via `codespell -q 3`
2022-06-23 10:14:35 +03:00
YueLiang 52e25acf22 Fix bug for get natice keycode failed in mac (#66)
TISCopyCurrentKeyboardInputSource will return null when using Chinese input method.
Use TISCopyCurrentASCIICapableKeyboardLayoutInputSource instead.
2022-02-21 10:01:45 +02:00
waneon 308c96c28f Fix invalid variable name in README.md 2022-02-05 15:02:03 +02:00
Shatur95 34330d6ff5 Link Gui as PUBLIC 2021-10-29 00:25:12 +03:00
Daniel Bermond 6a0cc377e6 Bump version to 1.5.0 2021-10-29 00:08:58 +03:00
Hennadii Chernyshchyk fcf83f3e36 Use QT_DEFAULT_MAJOR_VERSION 2021-10-28 23:47:14 +03:00
Hennadii Chernyshchyk 64fec66d35 Fix memory leak in README.md 2021-10-28 22:33:29 +03:00
Hennadii Chernyshchyk 1114df5081 Bump version to 1.4.2 in QMake 2021-10-05 19:09:12 +03:00
Hennadii Chernyshchyk e0bc2a9b9f Fix shared library build 2021-10-05 19:07:12 +03:00
Daniel Bermond 1d49a63827 CMake: add package version config file (#57)
By adding this file, client applications can have proper version
checking support when calling 'find_package()'.
2021-10-03 19:52:50 +03:00
Hennadii Chernyshchyk 7f5840fd34 Add CI 2021-10-03 16:53:20 +03:00
Daniel Bermond 7b10ea6d64 Qt6 support for Windows and Mac (#54)
This follows commit 25f2184.

On Windows, changing the return value of the qHash() variant that
takes one argument fixes the following warning on MSVC 2019:

qhotkey.cpp:(371,45): warning C4267: 'return': conversion from
'size_t' to 'uint', possible loss of data
2021-10-03 14:18:23 +03:00
Daniel Bermond 79e5dd65be CMake: change link type and remove Qt Widgets (#53)
Link type can be changed to PRIVATE. Only Qt Core will remain
as PUBLIC linking.

It looks like that Qt Widgets is not needed and can be removed.
On Qt6, Qt6::Gui is strictly needed.
2021-10-03 14:07:20 +03:00
Daniel Bermond dbec7d3a2d Readme: add build instructions
This will also provide information about the supported Qt versions.
2021-10-03 11:01:00 +03:00
Daniel Bermond 6b3cc35bbd CMake: honor CMAKE_INSTALL_INCLUDEDIR in exported target
Remove the hardcode to the 'include' directory in the CMake
exported target.

This will let the user correctly access the headers when
building a client application with a QHotkey package that
is installed with a CMAKE_INSTALL_INCLUDEDIR different
than 'include'.
2021-10-01 21:39:55 +03:00
Daniel Bermond 25f21849b3 Add support for Qt6 (#51)
CMake:
The 'QT_MAJOR' CMake variable controls which major version
of Qt is used for building. Defaults to '5', so nothing
changes when using the default 'cmake' invocation, as it
will default to search/build for Qt5.

qmake:
Just build in the usual way with 'qmake6 && make' or
'qmake-qt5 && make'.

When building with Qt6 on GNU/Linux and similar UNIXes,
the minimium required Qt version is 6.2.0, as Qt 6.1
and 6.0 lacks support for getting the X11 display.
2021-09-30 20:46:35 +03:00
18 changed files with 272 additions and 163 deletions
+56
View File
@@ -0,0 +1,56 @@
name: Build
on:
push:
branches-ignore:
- "releases/**"
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
jobs:
build:
strategy:
matrix:
qt_version: [5.12.12, 5.15.2, 6.2.2]
platform: [ubuntu-20.04, windows-latest, macos-latest]
include:
- qt_version: 6.2.2
additional_arguments: -D QT_DEFAULT_MAJOR_VERSION=6
- platform: ubuntu-20.04
make: make
CXXFLAGS: -Wall -Wextra -pedantic -Werror
MAKEFLAGS: -j2
- platform: macos-latest
make: make
CXXFLAGS: -Wall -Wextra -pedantic -Werror -Wno-gnu-zero-variadic-macro-arguments # Ignore false-positive warning for qCWarning
MAKEFLAGS: -j3
- platform: windows-latest
make: nmake
CXXFLAGS: /W4 /WX /MP
runs-on: ${{ matrix.platform }}
env:
CXXFLAGS: ${{ matrix.CXXFLAGS }}
MAKEFLAGS: ${{ matrix.MAKEFLAGS }}
steps:
- name: Clone repo
uses: actions/checkout@v2.3.4
- name: Install Qt
uses: jurplel/install-qt-action@v3.3.0
with:
version: ${{ matrix.qt_version }}
- name: Build with CMake as static
run: |
cmake . -D QHOTKEY_EXAMPLES=ON -D CMAKE_OSX_ARCHITECTURES="x86_64" ${{ matrix.additional_arguments }}
cmake --build .
- name: Build with CMake as shared
run: |
cmake . -D BUILD_SHARED_LIBS=ON -D QHOTKEY_EXAMPLES=ON -D CMAKE_OSX_ARCHITECTURES="x86_64" ${{ matrix.additional_arguments }}
cmake --build .
+70 -26
View File
@@ -1,61 +1,102 @@
cmake_minimum_required(VERSION 3.1)
cmake_minimum_required(VERSION 3.10)
project(qhotkey VERSION 1.2.2 LANGUAGES CXX)
project(qhotkey
VERSION 1.5.0
DESCRIPTION "Global hotkey library for Qt software"
HOMEPAGE_URL "https://skycoder42.github.io/QHotkey/"
LANGUAGES CXX)
option(QHOTKEY_EXAMPLES "Build examples" OFF)
option(QHOTKEY_INSTALL "Enable install rule" ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_AUTOMOC ON)
find_package(Qt5 COMPONENTS Core Widgets REQUIRED)
if(NOT QT_DEFAULT_MAJOR_VERSION)
set(QT_DEFAULT_MAJOR_VERSION 5 CACHE STRING "Qt version to use (5 or 6), defaults to 5")
endif()
qt5_wrap_cpp(MOC_HEADERS
QHotkey/qhotkey.h
QHotkey/qhotkey_p.h)
if(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} 6.2.0 COMPONENTS Core Gui REQUIRED)
else()
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS Core Gui REQUIRED)
endif()
set(LIBS
Qt5::Core
Qt5::Widgets)
# General settings
set(CPACK_PACKAGE_VENDOR "Skycoder42")
set(CPACK_PACKAGE_CONTACT "Shatur")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/README.md")
# CPACK: DEB Specific Settings
set(CPACK_DEBIAN_PACKAGE_NAME "libqhotkey")
set(CPACK_DEBIAN_PACKAGE_SECTION "Libraries")
# Set dependencies
if(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt6x11extras6 (>= 6.2.0)")
else()
set(CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5x11extras5 (>= 5.15.2)")
endif()
include(CPack)
set(SRC_FILES
QHotkey/qhotkey.cpp)
add_library(qhotkey QHotkey/qhotkey.cpp)
add_library(QHotkey::QHotkey ALIAS qhotkey)
target_link_libraries(qhotkey PUBLIC Qt${QT_DEFAULT_MAJOR_VERSION}::Core Qt${QT_DEFAULT_MAJOR_VERSION}::Gui)
target_compile_definitions(qhotkey PRIVATE QT_NO_SIGNALS_SLOTS_KEYWORDS)
if(BUILD_SHARED_LIBS)
target_compile_definitions(qhotkey PRIVATE QHOTKEY_LIBRARY)
target_compile_definitions(qhotkey PUBLIC QHOTKEY_SHARED)
endif()
if(APPLE)
find_library(CARBON_LIBRARY Carbon)
mark_as_advanced(CARBON_LIBRARY)
set(SRC_FILES ${SRC_FILES} QHotkey/qhotkey_mac.cpp)
set(LIBS ${LIBS} ${CARBON_LIBRARY})
target_sources(qhotkey PRIVATE QHotkey/qhotkey_mac.cpp)
target_link_libraries(qhotkey PRIVATE ${CARBON_LIBRARY})
elseif(WIN32)
set(SRC_FILES ${SRC_FILES} QHotkey/qhotkey_win.cpp)
target_sources(qhotkey PRIVATE QHotkey/qhotkey_win.cpp)
else()
find_package(X11 REQUIRED)
find_package(Qt5X11Extras REQUIRED)
include_directories(${X11_INCLUDE_DIR})
set(LIBS ${LIBS} ${X11_LIBRARIES} Qt5::X11Extras)
set(SRC_FILES ${SRC_FILES} QHotkey/qhotkey_x11.cpp)
if(QT_DEFAULT_MAJOR_VERSION GREATER_EQUAL 6)
target_link_libraries(qhotkey PRIVATE ${X11_LIBRARIES})
else()
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS X11Extras REQUIRED)
target_link_libraries(qhotkey
PRIVATE
${X11_LIBRARIES}
Qt${QT_DEFAULT_MAJOR_VERSION}::X11Extras)
endif()
add_library(qhotkey ${SRC_FILES} ${MOC_HEADERS})
add_library(QHotkey::QHotkey ALIAS qhotkey)
target_link_libraries(qhotkey ${LIBS})
include_directories(${X11_INCLUDE_DIR})
target_sources(qhotkey PRIVATE QHotkey/qhotkey_x11.cpp)
endif()
include(GNUInstallDirs)
target_include_directories(qhotkey
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/QHotkey>
$<INSTALL_INTERFACE:include>)
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
include(CMakePackageConfigHelpers)
set_target_properties(qhotkey PROPERTIES
SOVERSION ${PROJECT_VERSION_MAJOR}
VERSION ${PROJECT_VERSION})
VERSION ${PROJECT_VERSION}
INTERFACE_QHotkey_MAJOR_VERSION ${PROJECT_VERSION_MAJOR}
COMPATIBLE_INTERFACE_STRING QHotkey_MAJOR_VERSION)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/QHotkeyConfigVersion.cmake
VERSION "${PROJECT_VERSION}"
COMPATIBILITY AnyNewerVersion)
if(QHOTKEY_EXAMPLES)
add_subdirectory(HotkeyTest)
endif()
if(QHOTKEY_INSTALL)
include(GNUInstallDirs)
set(INSTALL_CONFIGDIR ${CMAKE_INSTALL_LIBDIR}/cmake/QHotkey)
install(
@@ -66,7 +107,10 @@ if(QHOTKEY_INSTALL)
install(FILES
${CMAKE_CURRENT_SOURCE_DIR}/QHotkey/qhotkey.h
${CMAKE_CURRENT_SOURCE_DIR}/QHotkey/QHotkey
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/)
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/QHotkeyConfigVersion.cmake
DESTINATION ${INSTALL_CONFIGDIR})
install(EXPORT QHotkeyConfig DESTINATION ${INSTALL_CONFIGDIR})
export(TARGETS qhotkey FILE QHotkeyConfig.cmake)
+5 -6
View File
@@ -1,12 +1,11 @@
set(CMAKE_INCLUDE_CURRENT_DIR ON)
qt5_wrap_ui(test_UI_HEADERS hottestwidget.ui)
qt5_wrap_cpp(test_MOC_HEADERS hottestwidget.h)
set(CMAKE_AUTOUIC ON)
add_executable(HotkeyTest
main.cpp
hottestwidget.cpp
${test_UI_HEADERS}
${test_MOC_HEADERS})
target_link_libraries(HotkeyTest Qt5::Widgets qhotkey)
target_include_directories(HotkeyTest PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
hottestwidget.ui)
find_package(Qt${QT_DEFAULT_MAJOR_VERSION} COMPONENTS Widgets REQUIRED)
target_link_libraries(HotkeyTest Qt${QT_DEFAULT_MAJOR_VERSION}::Widgets QHotkey::QHotkey)
-21
View File
@@ -1,21 +0,0 @@
#-------------------------------------------------
#
# Project created by QtCreator 2016-02-05T22:01:03
#
#-------------------------------------------------
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = HotkeyTest
TEMPLATE = app
include(../qhotkey.pri)
SOURCES += main.cpp\
hottestwidget.cpp
HEADERS += hottestwidget.h
FORMS += hottestwidget.ui
+2 -2
View File
@@ -927,7 +927,7 @@
<item>
<widget class="QLabel" name="label_7">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This test was designed to try out multi-threaded shortcuts. The QHotkey class is completly &lt;span style=&quot; font-weight:600;&quot;&gt;threadsafe&lt;/span&gt;, but this test can help to see if it acutally works (It does).&lt;/p&gt;&lt;p&gt;If activated, &lt;span style=&quot; font-style:italic;&quot;&gt;Hotkey 4 and Hotkey 5 &lt;/span&gt;of the Playground will each run on their own thread. This means:&lt;/p&gt;&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;Mainthread:&lt;/span&gt; Hotkey 1, 2, 3&lt;/li&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;Second thread:&lt;/span&gt; Hotkey 4&lt;/li&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;Third thread:&lt;/span&gt; Hotkey 5&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Note:&lt;/span&gt; The two hotkeys will be moved to the threads. For simplicity-reasons, you can't move them back in this test (But its possible, just not done here). Restart the test to get them back.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;This test was designed to try out multi-threaded shortcuts. The QHotkey class is completely &lt;span style=&quot; font-weight:600;&quot;&gt;threadsafe&lt;/span&gt;, but this test can help to see if it actually works (It does).&lt;/p&gt;&lt;p&gt;If activated, &lt;span style=&quot; font-style:italic;&quot;&gt;Hotkey 4 and Hotkey 5 &lt;/span&gt;of the Playground will each run on their own thread. This means:&lt;/p&gt;&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;Mainthread:&lt;/span&gt; Hotkey 1, 2, 3&lt;/li&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;Second thread:&lt;/span&gt; Hotkey 4&lt;/li&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;Third thread:&lt;/span&gt; Hotkey 5&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Note:&lt;/span&gt; The two hotkeys will be moved to the threads. For simplicity-reasons, you can't move them back in this test (But its possible, just not done here). Restart the test to get them back.&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
@@ -973,7 +973,7 @@
<item>
<widget class="QLabel" name="label_8">
<property name="text">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;QHotkey allows you to set native shortcuts explicitly. These, of course, only work on the platform they were choosen for. All platform use special constants for their key codes and modifiers, which makes it pretty simple to use them from code. If you want to test them out here, google for the tables.&lt;/p&gt;&lt;p&gt;In most cases, you will not need to specify native shortcuts directly. However, as explaind on previos tabs, some shotcuts may not be creatable from Qt's key (e.g. Numblock numbers). In that case, you can set the directly.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;Example: Ctrl+A&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Windows:&lt;/span&gt; Key: &lt;span style=&quot; font-style:italic;&quot;&gt;0x0041&lt;/span&gt;, Modifier: &lt;span style=&quot; font-style:italic;&quot;&gt;0x0002&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;X11:&lt;/span&gt; Key: &lt;span style=&quot; font-style:italic;&quot;&gt;0x0026&lt;/span&gt;, Modifier: &lt;span style=&quot; font-style:italic;&quot;&gt;0x0004&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;OsX:&lt;/span&gt; Key: &lt;span style=&quot; font-style:italic;&quot;&gt;0x0000&lt;/span&gt;, Modifier: &lt;span style=&quot; font-style:italic;&quot;&gt;0x0100&lt;/span&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;QHotkey allows you to set native shortcuts explicitly. These, of course, only work on the platform they were chosen for. All platform use special constants for their key codes and modifiers, which makes it pretty simple to use them from code. If you want to test them out here, google for the tables.&lt;/p&gt;&lt;p&gt;In most cases, you will not need to specify native shortcuts directly. However, as explained on previous tabs, some shortcuts may not be creatable from Qt's key (e.g. Numblock numbers). In that case, you can set the directly.&lt;/p&gt;&lt;p&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;Example: Ctrl+A&lt;/span&gt;&lt;/p&gt;&lt;ul style=&quot;margin-top: 0px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; -qt-list-indent: 1;&quot;&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Windows:&lt;/span&gt; Key: &lt;span style=&quot; font-style:italic;&quot;&gt;0x0041&lt;/span&gt;, Modifier: &lt;span style=&quot; font-style:italic;&quot;&gt;0x0002&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;X11:&lt;/span&gt; Key: &lt;span style=&quot; font-style:italic;&quot;&gt;0x0026&lt;/span&gt;, Modifier: &lt;span style=&quot; font-style:italic;&quot;&gt;0x0004&lt;/span&gt;&lt;/li&gt;&lt;li style=&quot; margin-top:12px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;OsX:&lt;/span&gt; Key: &lt;span style=&quot; font-style:italic;&quot;&gt;0x0000&lt;/span&gt;, Modifier: &lt;span style=&quot; font-style:italic;&quot;&gt;0x0100&lt;/span&gt;&lt;span style=&quot; text-decoration: underline;&quot;&gt;&lt;br/&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="wordWrap">
<bool>true</bool>
-10
View File
@@ -1,10 +0,0 @@
TEMPLATE = subdirs
SUBDIRS += \
HotkeyTest \
QHotkey
DISTFILES += README.md \
LICENSE \
doc/qhotkey.doxy \
doc/qhotkey.dox
-16
View File
@@ -1,16 +0,0 @@
TEMPLATE = lib
win32: CONFIG += dll
TARGET = QHotkey
VERSION = 1.2.1
include(../qhotkey.pri)
DEFINES += QHOTKEY_LIB QHOTKEY_LIB_BUILD
# use INSTALL_ROOT to modify the install location
headers.files = $$PUBLIC_HEADERS
headers.path = $$[QT_INSTALL_HEADERS]
target.path = $$[QT_INSTALL_LIBS]
INSTALLS += target headers
+23 -6
View File
@@ -10,9 +10,15 @@ Q_LOGGING_CATEGORY(logQHotkey, "QHotkey")
void QHotkey::addGlobalMapping(const QKeySequence &shortcut, QHotkey::NativeShortcut nativeShortcut)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const int key = shortcut[0].toCombined();
#else
const int key = shortcut[0];
#endif
QMetaObject::invokeMethod(QHotkeyPrivate::instance(), "addMappingInvoked", Qt::QueuedConnection,
Q_ARG(Qt::Key, Qt::Key(shortcut[0] & ~Qt::KeyboardModifierMask)),
Q_ARG(Qt::KeyboardModifiers, Qt::KeyboardModifiers(shortcut[0] & Qt::KeyboardModifierMask)),
Q_ARG(Qt::Key, Qt::Key(key & ~Qt::KeyboardModifierMask)),
Q_ARG(Qt::KeyboardModifiers, Qt::KeyboardModifiers(key & Qt::KeyboardModifierMask)),
Q_ARG(QHotkey::NativeShortcut, nativeShortcut));
}
@@ -56,7 +62,12 @@ QKeySequence QHotkey::shortcut() const
{
if(_keyCode == Qt::Key_unknown)
return QKeySequence();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
return QKeySequence((_keyCode | _modifiers).toCombined());
#else
return QKeySequence(static_cast<int>(_keyCode | _modifiers));
#endif
}
Qt::Key QHotkey::keyCode() const
@@ -88,8 +99,14 @@ bool QHotkey::setShortcut(const QKeySequence &shortcut, bool autoRegister)
"Only the first shortcut will be used!");
}
return setShortcut(Qt::Key(shortcut[0] & ~Qt::KeyboardModifierMask),
Qt::KeyboardModifiers(shortcut[0] & Qt::KeyboardModifierMask),
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const int key = shortcut[0].toCombined();
#else
const int key = shortcut[0];
#endif
return setShortcut(Qt::Key(key & ~Qt::KeyboardModifierMask),
Qt::KeyboardModifiers(key & Qt::KeyboardModifierMask),
autoRegister);
}
@@ -349,12 +366,12 @@ bool QHotkey::NativeShortcut::operator !=(QHotkey::NativeShortcut other) const
valid != other.valid;
}
uint qHash(QHotkey::NativeShortcut key)
QHOTKEY_HASH_SEED qHash(QHotkey::NativeShortcut key)
{
return qHash(key.key) ^ qHash(key.modifier);
}
uint qHash(QHotkey::NativeShortcut key, uint seed)
QHOTKEY_HASH_SEED qHash(QHotkey::NativeShortcut key, QHOTKEY_HASH_SEED seed)
{
return qHash(key.key, seed) ^ qHash(key.modifier, seed);
}
+18 -12
View File
@@ -6,18 +6,24 @@
#include <QPair>
#include <QLoggingCategory>
#ifdef QHOTKEY_LIB
#ifdef QHOTKEY_LIB_BUILD
#define QHOTKEY_SHARED_EXPORT Q_DECL_EXPORT
#ifdef QHOTKEY_SHARED
# ifdef QHOTKEY_LIBRARY
# define QHOTKEY_EXPORT Q_DECL_EXPORT
# else
#define QHOTKEY_SHARED_EXPORT Q_DECL_IMPORT
# define QHOTKEY_EXPORT Q_DECL_IMPORT
# endif
#else
#define QHOTKEY_SHARED_EXPORT
# define QHOTKEY_EXPORT
#endif
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#define QHOTKEY_HASH_SEED size_t
#else
#define QHOTKEY_HASH_SEED uint
#endif
//! A class to define global, systemwide Hotkeys
class QHOTKEY_SHARED_EXPORT QHotkey : public QObject
class QHOTKEY_EXPORT QHotkey : public QObject
{
Q_OBJECT
//! @private
@@ -30,7 +36,7 @@ class QHOTKEY_SHARED_EXPORT QHotkey : public QObject
public:
//! Defines shortcut with native keycodes
class QHOTKEY_SHARED_EXPORT NativeShortcut {
class QHOTKEY_EXPORT NativeShortcut {
public:
//! The native keycode
quint32 key;
@@ -82,7 +88,7 @@ public:
//! Get the current native shortcut
NativeShortcut currentNativeShortcut() const;
public slots:
public Q_SLOTS:
//! @writeAcFn{QHotkey::registered}
bool setRegistered(bool registered);
@@ -96,7 +102,7 @@ public slots:
//! Set this hotkey to a native shortcut
bool setNativeShortcut(QHotkey::NativeShortcut nativeShortcut, bool autoRegister = false);
signals:
Q_SIGNALS:
//! Will be emitted if the shortcut is pressed
void activated(QPrivateSignal);
@@ -114,10 +120,10 @@ private:
bool _registered;
};
uint QHOTKEY_SHARED_EXPORT qHash(QHotkey::NativeShortcut key);
uint QHOTKEY_SHARED_EXPORT qHash(QHotkey::NativeShortcut key, uint seed);
QHOTKEY_HASH_SEED QHOTKEY_EXPORT qHash(QHotkey::NativeShortcut key);
QHOTKEY_HASH_SEED QHOTKEY_EXPORT qHash(QHotkey::NativeShortcut key, QHOTKEY_HASH_SEED seed);
QHOTKEY_SHARED_EXPORT Q_DECLARE_LOGGING_CATEGORY(logQHotkey)
QHOTKEY_EXPORT Q_DECLARE_LOGGING_CATEGORY(logQHotkey)
Q_DECLARE_METATYPE(QHotkey::NativeShortcut)
-1
View File
@@ -1 +0,0 @@
message(The pri file has been moved one directory up! use that one instead)
+3 -3
View File
@@ -7,7 +7,7 @@ class QHotkeyPrivateMac : public QHotkeyPrivate
{
public:
// QAbstractNativeEventFilter interface
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
bool nativeEventFilter(const QByteArray &eventType, void *message, _NATIVE_EVENT_RESULT *result) override;
static OSStatus hotkeyPressEventHandler(EventHandlerCallRef nextHandler, EventRef event, void* data);
static OSStatus hotkeyReleaseEventHandler(EventHandlerCallRef nextHandler, EventRef event, void* data);
@@ -33,7 +33,7 @@ bool QHotkeyPrivate::isPlatformSupported()
bool QHotkeyPrivateMac::isHotkeyHandlerRegistered = false;
QHash<QHotkey::NativeShortcut, EventHotKeyRef> QHotkeyPrivateMac::hotkeyRefs;
bool QHotkeyPrivateMac::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
bool QHotkeyPrivateMac::nativeEventFilter(const QByteArray &eventType, void *message, _NATIVE_EVENT_RESULT *result)
{
Q_UNUSED(eventType)
Q_UNUSED(message)
@@ -134,7 +134,7 @@ quint32 QHotkeyPrivateMac::nativeKeycode(Qt::Key keycode, bool &ok)
UTF16Char ch = keycode;
CFDataRef currentLayoutData;
TISInputSourceRef currentKeyboard = TISCopyCurrentKeyboardInputSource();
TISInputSourceRef currentKeyboard = TISCopyCurrentASCIICapableKeyboardLayoutInputSource();
if (currentKeyboard == NULL)
return 0;
+7 -4
View File
@@ -7,7 +7,13 @@
#include <QMutex>
#include <QGlobalStatic>
class QHOTKEY_SHARED_EXPORT QHotkeyPrivate : public QObject, public QAbstractNativeEventFilter
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
#define _NATIVE_EVENT_RESULT qintptr
#else
#define _NATIVE_EVENT_RESULT long
#endif
class QHOTKEY_EXPORT QHotkeyPrivate : public QObject, public QAbstractNativeEventFilter
{
Q_OBJECT
@@ -53,7 +59,4 @@ private:
return hotkeyPrivate;\
}
Q_DECLARE_METATYPE(Qt::Key)
Q_DECLARE_METATYPE(Qt::KeyboardModifiers)
#endif // QHOTKEY_P_H
+16 -9
View File
@@ -1,7 +1,9 @@
#include "qhotkey.h"
#include "qhotkey_p.h"
#include <qt_windows.h>
#include <algorithm>
#include <QDebug>
#include <QList>
#include <QTimer>
#define HKEY_ID(nativeShortcut) (((nativeShortcut.key ^ (nativeShortcut.modifier << 8)) & 0x0FFF) | 0x7000)
@@ -15,7 +17,7 @@ class QHotkeyPrivateWin : public QHotkeyPrivate
public:
QHotkeyPrivateWin();
// QAbstractNativeEventFilter interface
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
bool nativeEventFilter(const QByteArray &eventType, void *message, _NATIVE_EVENT_RESULT *result) override;
protected:
void pollForHotkeyRelease();
@@ -28,7 +30,7 @@ protected:
private:
static QString formatWinError(DWORD winError);
QTimer pollTimer;
QHotkey::NativeShortcut polledShortcut;
QList<QHotkey::NativeShortcut> polledShortcuts;
};
NATIVE_INSTANCE(QHotkeyPrivateWin)
@@ -42,7 +44,7 @@ bool QHotkeyPrivate::isPlatformSupported()
return true;
}
bool QHotkeyPrivateWin::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
bool QHotkeyPrivateWin::nativeEventFilter(const QByteArray &eventType, void *message, _NATIVE_EVENT_RESULT *result)
{
Q_UNUSED(eventType)
Q_UNUSED(result)
@@ -51,8 +53,9 @@ bool QHotkeyPrivateWin::nativeEventFilter(const QByteArray &eventType, void *mes
if(msg->message == WM_HOTKEY) {
QHotkey::NativeShortcut shortcut = {HIWORD(msg->lParam), LOWORD(msg->lParam)};
this->activateShortcut(shortcut);
this->polledShortcut = shortcut;
if (this->polledShortcuts.empty())
this->pollTimer.start();
this->polledShortcuts.append(shortcut);
}
return false;
@@ -60,11 +63,15 @@ bool QHotkeyPrivateWin::nativeEventFilter(const QByteArray &eventType, void *mes
void QHotkeyPrivateWin::pollForHotkeyRelease()
{
bool pressed = (GetAsyncKeyState(this->polledShortcut.key) & (1 << 15)) != 0;
if(!pressed) {
auto it = std::remove_if(this->polledShortcuts.begin(), this->polledShortcuts.end(), [this](const QHotkey::NativeShortcut &shortcut) {
bool pressed = (GetAsyncKeyState(shortcut.key) & (1 << 15)) != 0;
if (!pressed)
this->releaseShortcut(shortcut);
return !pressed;
});
this->polledShortcuts.erase(it, this->polledShortcuts.end());
if (this->polledShortcuts.empty())
this->pollTimer.stop();
this->releaseShortcut(this->polledShortcut);
}
}
quint32 QHotkeyPrivateWin::nativeKeycode(Qt::Key keycode, bool &ok)
@@ -235,7 +242,7 @@ quint32 QHotkeyPrivateWin::nativeKeycode(Qt::Key keycode, bool &ok)
default:
if(keycode <= 0xFFFF)
return (byte)keycode;
return static_cast<BYTE>(keycode);
else {
ok = false;
return 0;
+39 -6
View File
@@ -1,13 +1,19 @@
#include "qhotkey.h"
#include "qhotkey_p.h"
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
#include <QGuiApplication>
#else
#include <QDebug>
#include <QX11Info>
#endif
#include <QThreadStorage>
#include <QTimer>
#include <X11/Xlib.h>
#include <xcb/xcb.h>
//compability to pre Qt 5.8
//compatibility to pre Qt 5.8
#ifndef Q_FALLTHROUGH
#define Q_FALLTHROUGH() (void)0
#endif
@@ -16,7 +22,7 @@ class QHotkeyPrivateX11 : public QHotkeyPrivate
{
public:
// QAbstractNativeEventFilter interface
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) Q_DECL_OVERRIDE;
bool nativeEventFilter(const QByteArray &eventType, void *message, _NATIVE_EVENT_RESULT *result) override;
protected:
// QHotkeyPrivate interface
@@ -52,13 +58,17 @@ NATIVE_INSTANCE(QHotkeyPrivateX11)
bool QHotkeyPrivate::isPlatformSupported()
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
return qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
#else
return QX11Info::isPlatformX11();
#endif
}
const QVector<quint32> QHotkeyPrivateX11::specialModifiers = {0, Mod2Mask, LockMask, (Mod2Mask | LockMask)};
const quint32 QHotkeyPrivateX11::validModsMask = ShiftMask | ControlMask | Mod1Mask | Mod4Mask;
bool QHotkeyPrivateX11::nativeEventFilter(const QByteArray &eventType, void *message, long *result)
bool QHotkeyPrivateX11::nativeEventFilter(const QByteArray &eventType, void *message, _NATIVE_EVENT_RESULT *result)
{
Q_UNUSED(eventType)
Q_UNUSED(result)
@@ -120,8 +130,19 @@ quint32 QHotkeyPrivateX11::nativeKeycode(Qt::Key keycode, bool &ok)
return 0;
}
if(QX11Info::isPlatformX11()) {
auto res = XKeysymToKeycode(QX11Info::display(), keysym);
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
const QNativeInterface::QX11Application *x11Interface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
#else
const bool x11Interface = QX11Info::isPlatformX11();
#endif
if(x11Interface) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
Display *display = x11Interface->display();
#else
Display *display = QX11Info::display();
#endif
auto res = XKeysymToKeycode(display, keysym);
if(res != 0)
ok = true;
return res;
@@ -146,8 +167,15 @@ quint32 QHotkeyPrivateX11::nativeModifiers(Qt::KeyboardModifiers modifiers, bool
bool QHotkeyPrivateX11::registerShortcut(QHotkey::NativeShortcut shortcut)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
const QNativeInterface::QX11Application *x11Interface = qGuiApp->nativeInterface<QNativeInterface::QX11Application>();
Display *display = x11Interface->display();
#else
const bool x11Interface = QX11Info::isPlatformX11();
Display *display = QX11Info::display();
if(!display || !QX11Info::isPlatformX11())
#endif
if(!display || !x11Interface)
return false;
HotkeyErrorHandler errorHandler;
@@ -172,7 +200,12 @@ bool QHotkeyPrivateX11::registerShortcut(QHotkey::NativeShortcut shortcut)
bool QHotkeyPrivateX11::unregisterShortcut(QHotkey::NativeShortcut shortcut)
{
#if QT_VERSION >= QT_VERSION_CHECK(6, 2, 0)
Display *display = qGuiApp->nativeInterface<QNativeInterface::QX11Application>()->display();
#else
Display *display = QX11Info::display();
#endif
if(!display)
return false;
+25 -10
View File
@@ -14,6 +14,21 @@ The QHotkey is a class that can be used to create hotkeys/global shortcuts, aka
**Note:** For now Wayland is not supported, as it is simply not possible to register a global shortcut with wayland. For more details, or possible Ideas on how to get Hotkeys working on wayland, see [Issue #14](https://github.com/Skycoder42/QHotkey/issues/14).
## Building
QHotkey supports both Qt6 and Qt5. When using Qt6, version 6.2.0 or later required. It can be built using the CMake building system.
### CMake
The CMake `QT_DEFAULT_MAJOR_VERSION` variable controls which major version of Qt is used for building, and defaults to `5`. For example, use the CMake command line option `-DQT_DEFAULT_MAJOR_VERSION=6` for building with Qt6. To build the testing application `QHotkeyTest`, specify `-DQHOTKEY_EXAMPLES=ON`. CMake example usage:
```
$ cd QHotkey
$ cmake -B build -S . -DQT_DEFAULT_MAJOR_VERSION=6
$ cmake --build build
# cmake --install build
```
## Installation
The package is providet as qpm package, [`de.skycoder42.qhotkey`](https://www.qpm.io/packages/de.skycoder42.qhotkey/index.html). You can install it either via qpmx (preferred) or directly via qpm.
@@ -48,17 +63,17 @@ The following example shows a simple application that will run without a window
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QApplication app(argc, argv);
auto hotkey = new QHotkey(QKeySequence("ctrl+alt+Q"), true, &a);//The hotkey will be automatically registered
qDebug() << "Is Registered: " << hotkey->isRegistered();
QHotkey hotkey(QKeySequence("Ctrl+Alt+Q"), true, &app); //The hotkey will be automatically registered
qDebug() << "Is registered:" << hotkey.isRegistered();
QObject::connect(hotkey, &QHotkey::activated, qApp, [&](){
QObject::connect(&hotkey, &QHotkey::activated, qApp, [&](){
qDebug() << "Hotkey Activated - the application will quit now";
qApp->quit();
});
return a.exec();
return app.exec();
}
```
@@ -68,18 +83,18 @@ int main(int argc, char *argv[])
By running the example in `./HotkeyTest` you can test out the QHotkey class. There are 4 sections:
- **Playground:** You can enter some sequences here and try it out with different key combinations.
- **Testings:** A list of selected hotkeys. Activate it and try out which ones work for you (*Hint:* Depending on OS and keyboard layout, it's very possible that a few don't work).
- **Threading:** Activate the checkbox to move 2 Hotkeys of the playground to seperate threads. It should work without a difference.
- **Threading:** Activate the checkbox to move 2 Hotkeys of the playground to separate threads. It should work without a difference.
- **Native Shortcut**: Allows you to try out the direct usage of native shortcuts
### Logging
By default, QHotkey prints some warning messages if something goes wrong (For example, a key that cannot be translated). All messages of QHotkey are grouped into the [QLoggingCategory](https://doc.qt.io/qt-5/qloggingcategory.html) `"QHotkey"`. If you want to simply disable the logging, call the folling function somewhere in your code:
By default, QHotkey prints some warning messages if something goes wrong (For example, a key that cannot be translated). All messages of QHotkey are grouped into the [QLoggingCategory](https://doc.qt.io/qt-5/qloggingcategory.html) `"QHotkey"`. If you want to simply disable the logging, call the following function somewhere in your code:
```cpp
QLoggingCategory::setFilterRules(QStringLiteral("QHotkey.warning=false"));
```
This will turn all warnings of QHotkey of (It only uses warnings for now, thats why this is enough). For more information about all the things you can do with the logging categories, check the Qt-Documentation
This will turn all warnings of QHotkey of (It only uses warnings for now, that's why this is enough). For more information about all the things you can do with the logging categories, check the Qt-Documentation
## Thread saftey
The QHotkey class itself is reentrant - wich means you can create as many instances as required on any thread. This allows you to use the QHotkey on all threads. **But** you should never use the QHotkey instance on a thread that is different from the one the instance belongs to! Internally the system uses a singleton instance that handles the hotkey events and distributes them to the QHotkey instances. This internal class is completley threadsafe.
## Thread safety
The QHotkey class itself is reentrant - which means you can create as many instances as required on any thread. This allows you to use the QHotkey on all threads. **But** you should never use the QHotkey instance on a thread that is different from the one the instance belongs to! Internally the system uses a singleton instance that handles the hotkey events and distributes them to the QHotkey instances. This internal class is completely threadsafe.
However, this singleton instance only runs on the main thread. (One reason is that some of the OS-Functions are not thread safe). To make threaded hotkeys possible, the critical functions (registering/unregistering hotkeys and keytranslation) are all run on the mainthread too. The QHotkey instances on other threads use `QMetaObject::invokeMethod` with a `Qt::BlockingQueuedConnection`.
+3 -3
View File
@@ -38,7 +38,7 @@ In addition to the normal accessors, a modification of the QHotkey::shortcut pro
@default{`QKeySequence()` (`Qt::Key_unknown` + `Qt::NoModifier`)}
Holds the shortcut this hotkey will be registered on. It can be used as QKeySequence or as a combination of
a Qt::Key and Qt::KeyboardModifiers. All write-accessors specifiy an additional parameter to immediatly register
a Qt::Key and Qt::KeyboardModifiers. All write-accessors specify an additional parameter to immediately register
the hotkey.
@note Since the operating systems do not support hotkeys that consist of multiple key-combinations in a sequence,
@@ -107,7 +107,7 @@ it does. This does not happen if used from the main thread.
If the hotkey is still registered on destruction, it will automatically unregister itself.
@warning If using a hotkey on a thread other than the main thread, make shure the QApplication is still running it's eventloop.
@warning If using a hotkey on a thread other than the main thread, make sure the QApplication is still running it's eventloop.
Otherwise your application will hang up.
@sa QHotkey::registered
@@ -144,7 +144,7 @@ from the thread this instance lives on.
This method can be used to remap specific hotkey to a different native representation than the
one that would be used by default. This can be useful if specific key combinations work fine
on allmost all platforms, but on one you need a different keycode for the same effect. See
on almost all platforms, but on one you need a different keycode for the same effect. See
[Issue #15](https://github.com/Skycoder42/QHotkey/issues/15) for an example where this is the
case.
-6
View File
@@ -1,6 +0,0 @@
mac: LIBS += -framework Carbon
else:win32: LIBS += -luser32
else:unix {
QT += x11extras
LIBS += -lX11
}
-17
View File
@@ -1,17 +0,0 @@
CONFIG += C++11
PUBLIC_HEADERS += $$PWD/QHotkey/qhotkey.h \
$$PWD/QHotkey/QHotkey
HEADERS += $$PUBLIC_HEADERS \
$$PWD/QHotkey/qhotkey_p.h
SOURCES += $$PWD/QHotkey/qhotkey.cpp
mac: SOURCES += $$PWD/QHotkey/qhotkey_mac.cpp
else:win32: SOURCES += $$PWD/QHotkey/qhotkey_win.cpp
else:unix: SOURCES += $$PWD/QHotkey/qhotkey_x11.cpp
INCLUDEPATH += $$PWD/QHotkey
include($$PWD/qhotkey.prc)