Expose enum to the metaobject compiler
ClosedPublic

Authored by apol on Dec 4 2019, 1:10 AM.

Details

Summary

Should Help the PersonActionsModel work on QML

Diff Detail

Repository
R307 KPeople
Branch
master
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 19467
Build 19485: arc lint + arc unit
apol created this revision.Dec 4 2019, 1:10 AM
Restricted Application added a project: Frameworks. · View Herald TranscriptDec 4 2019, 1:10 AM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
apol requested review of this revision.Dec 4 2019, 1:10 AM

I thought you need some kind of qmlRegisterType<KPeople::staticMetaObject()> in order to use it?

(but if it does work as-is, ship it)

lnj added a subscriber: lnj.Dec 4 2019, 12:06 PM

The ActionsTypes are already registered using a wrapper class (this was required before Qt 5.8 / Q_NAMESPACE) in peopleqmlplugin.cpp. The Q_NAMESPACE solution would be better I think.

And yes, the namespace still needs to be registered using e.g. qmlRegisterUncreatableMetaObject(KPeople::staticMetaObject, uri, 1, 0, "KPeople", QStringLiteral("Access to enums & flags only")); (see https://doc.qt.io/qt-5/qqmlengine.html#qmlRegisterUncreatableMetaObject).

I tried to test this but it gave me a linker error about KPeople::staticMetaObject although kpeopledeclarative is linking against kpeoplewidgets whichs adds the meta object. :/

apol updated this revision to Diff 70895.Dec 4 2019, 12:44 PM

Export the namespace

Bah, seems Q_NAMESPACE_EXPORT is quite new

apol updated this revision to Diff 70997.Dec 6 2019, 12:33 AM

Alternative approach without Q_NAMESPACE_EXPORT, which is too new

davidedmundson accepted this revision.Dec 6 2019, 12:35 AM
This revision is now accepted and ready to land.Dec 6 2019, 12:35 AM
This revision was automatically updated to reflect the committed changes.
dfaure added a subscriber: dfaure.Dec 8 2019, 10:22 PM

CI = not happy

src/declarative/peopleqmlplugin.cpp:73: undefined reference to `KPeople::staticMetaObject'