mbasaglia / Qt-Color-Widgets

Color wheel widget and dialog for Qt
147 stars 54 forks source link

Error during compilation (Qt 5.6.1) #19

Closed andusvan closed 7 years ago

andusvan commented 8 years ago

Hello!

I'm getting an error during compilation against Qt 5.6.1 under Fedora 23. Any fix for this available?!

Regards Sven

In file included from /usr/include/qt5/QtCore/QtGlobal:1:0, from include/colorwidgets_global.hpp:4, from include/color_dialog.hpp:25, from src/color_dialog.cpp:23: /usr/include/qt5/QtCore/qmetatype.h: In instantiation of 'constexpr int qMetaTypeId() [with T = color_widgets::ColorPreview::DisplayMode]': /usr/include/qt5/QtCore/qvariant.h:496:35: required from 'QVariant qVariantFromValue(const T&) [with T = color_widgets::ColorPreview::DisplayMode]' /usr/include/qt5/QtCore/qvariant.h:350:31: required from 'static QVariant QVariant::fromValue(const T&) [with T = color_widgets::ColorPreview::DisplayMode]' out/generated/ui_color_dialog.h:105:105: required from here /usr/include/qt5/QtCore/qmetatype.h:1739:5: error: static assertion failed: Type is not registered, please use the Q_DECLARE_METATYPE macro to make it known to Qt's meta-object system Q_STATIC_ASSERT_X(QMetaTypeId2::Defined, "Type is not registered, please use the Q_DECLARE_METATYPE macr ^ In file included from /usr/include/qt5/QtCore/qobject.h:48:0, from /usr/include/qt5/QtWidgets/qwidget.h:38, from /usr/include/qt5/QtWidgets/QWidget:1, from include/color_preview.hpp:28, from include/color_dialog.hpp:26, from src/color_dialog.cpp:23: /usr/include/qt5/QtCore/qmetatype.h: In instantiation of 'static constexpr int QMetaTypeId2::qt_metatype_id() [with T = color_widgets::ColorPreview::DisplayMode]': /usr/include/qt5/QtCore/qmetatype.h:1740:43: required from 'constexpr int qMetaTypeId() [with T = color_widgets::ColorPreview::DisplayMode]' /usr/include/qt5/QtCore/qvariant.h:496:35: required from 'QVariant qVariantFromValue(const T&) [with T = color_widgets::ColorPreview::DisplayMode]' /usr/include/qt5/QtCore/qvariant.h:350:31: required from 'static QVariant QVariant::fromValue(const T&) [with T = color_widgets::ColorPreview::DisplayMode]' out/generated/ui_color_dialog.h:105:105: required from here /usr/include/qt5/QtCore/qmetatype.h:1598:96: error: 'qt_metatype_id' is not a member of 'QMetaTypeId' static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return QMetaTypeId::qt_metatype_id(); } ^ /usr/include/qt5/QtCore/qmetatype.h:1598:100: error: body of constexpr function 'static constexpr int QMetaTypeId2::qt_metatype_id() [with T = color_widgets::ColorPreview::DisplayMode]' not a return-statement static inline Q_DECL_CONSTEXPR int qt_metatype_id() { return QMetaTypeId::qt_metatype_id(); } ^ Makefile:607: recipe for target 'out/obj/color_dialog.o' failed

mbasaglia commented 8 years ago

Are you using CMake or qmake as build system? Also, which compiler?

andusvan commented 8 years ago

Sorry, here the missing information: The "standard" qmake-qt5 from fedora. g++ (GCC) 5.3.1 20160406 (Red Hat 5.3.1-6)

mbasaglia commented 8 years ago

Hmm, I can't repro with QMake version 3.0 Using Qt version 5.5 and g++ 5.4.0.

andusvan commented 8 years ago

I'm using QMake version 3.0 too. The only difference is the newer Qt version (5.6.x). Does the newer Qt need the usage of the Q_DECLARE_METATYPE marco?

andusvan commented 8 years ago

Ok. I think I solved the problem. The patch is applied.

Qt5.6-metatype.patch.txt

Thanks for your time!

mbasaglia commented 8 years ago

I'm going to reopen this to keep in mind I have to apply that patch and tets