Skycoder42 / QHotkey

A global shortcut/hotkey for Desktop Qt-Applications
BSD 3-Clause "New" or "Revised" License
548 stars 161 forks source link

Add CI #56

Closed Shatur closed 2 years ago

Shatur commented 2 years ago

@dbermond, I have a compilation issue with Qt 6.2.0. Does it work on your side?

dbermond commented 2 years ago

By the logs, it looks like that commit 79e5dd65be broke the QHotkeyTest testing application due to Qt Widgets removal from the library.

This change can fix it:

--- a/HotkeyTest/CMakeLists.txt
+++ b/HotkeyTest/CMakeLists.txt
@@ -1,9 +1,11 @@
 set(CMAKE_INCLUDE_CURRENT_DIR ON)

 if(QT_MAJOR GREATER_EQUAL 6)
+    find_package(Qt${QT_MAJOR} 6.2.0 COMPONENTS Widgets REQUIRED)
     qt_wrap_ui(test_UI_HEADERS hottestwidget.ui)
     qt_wrap_cpp(test_MOC_HEADERS hottestwidget.h)
 else()
+    find_package(Qt${QT_MAJOR} COMPONENTS Widgets REQUIRED)
     qt5_wrap_ui(test_UI_HEADERS hottestwidget.ui)
     qt5_wrap_cpp(test_MOC_HEADERS hottestwidget.h)
 endif()

Looks fine to send a pull request?

Shatur commented 2 years ago

This change can fix it:

Wow, we wrote messages almost at the same time :D Yes, thanks, I already fixed it :)

But I have another issue with compilation. Could you check it?

dbermond commented 2 years ago

@dbermond, I have a compilation issue with Qt 6.2.0. Does it work on your side?

Looks like to be the QHotkeyTest that I mentioned.

dbermond commented 2 years ago

Wow, we wrote messages almost at the same time :D

Cool! :)

I already fixed it :)

Nice.

After your fix, the error shown on the log is another now. It seems to be related to calling Q_DECLARE_METATYPE() on Qt::Key and Qt::KeyboardModifiers (qhotkey_p.h, lines 61 and 62), as it says error: redefinition of 'struct QMetaTypeId<Qt::Key>'

I don't have this error on gcc 11.1.0 + CMake 3.21.3. It looks like that registration of those types is not needed, since they are Qt types and should be already registered. Try to remove/comment them. It works nice for me on Qt5 and Qt6 when commenting/removing them.

Shatur commented 2 years ago

It seems to be related to calling Q_DECLARE_METATYPE() on Qt::Key and Qt::KeyboardModifiers (qhotkey_p.h, lines 61 and 62), as it says error: redefinition of 'struct QMetaTypeId'

Yes, this is what I asked about in my very first message :)

Thanks, you are right, I double-checked on my machine and it looks like these definitions are unnecessary indeed.

dbermond commented 2 years ago

Good to know it worked! :)