Fix build with Qt6
QT_BEGIN/END_HEADER has been defined to nothing for a long time: https://code.qt.io/cgit/qt/qtbase.git/commit/?id=1e33f30f75dea6481c85b5f636f1136eb1a3da15 In Qt6 use const in qobject_cast<const QObject*>, otherwise the build fails with some interesting errors (note that the build fails in Qt5 if I add const in qobject_cast< QObject*>...): /usr/include/qt6/QtCore/qobjectdefs.h: In instantiation of ‘struct QtPrivate::HasQ_OBJECT_Macro<Akonadi::GidExtractorInterface>’: /usr/include/qt6/QtCore/qobject.h:481:58: required from ‘T qobject_cast(const QObject*) [with T = Akonadi::GidExtractorInterface*]’ /home/ahmad/kdesrc/kde/src/kde/pim/akonadi/src/core/gidextractor.cpp:18:87: required from here /usr/include/qt6/QtCore/qobjectdefs.h:486:37: error: ‘qt_metacall’ is not a member of ‘Akonadi::GidExtractorInterface’ 486 | enum { Value = sizeof(test(&Object::qt_metacall)) == sizeof(int) }; | ^~~~~~~~~~~~~~~~~~~~ /usr/include/qt6/QtCore/qobject.h: In instantiation of ‘T qobject_cast(const QObject*) [with T = Akonadi::GidExtractorInterface*]’: /home/ahmad/kdesrc/kde/src/kde/pim/akonadi/src/core/gidextractor.cpp:18:87: required from here /usr/include/qt6/QtCore/qobject.h:481:58: error: static assertion failed: qobject_cast requires the type to have a Q_OBJECT macro 481 | static_assert(QtPrivate::HasQ_OBJECT_Macro<ObjType>::Value, | ^~~~~ /usr/include/qt6/QtCore/qobject.h:481:58: note: ‘QtPrivate::HasQ_OBJECT_Macro<Akonadi::GidExtractorInterface>::Value’ evaluates to false /usr/include/qt6/QtCore/qobject.h:483:53: error: ‘staticMetaObject’ is not a member of ‘ObjType’ {aka ‘Akonadi::GidExtractorInterface’} 483 | return static_cast<T>(ObjType::staticMetaObject.cast(object));
parent
d279087d
Please register or sign in to comment