Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add replacements for QML_ELEMENT macro and friends #83

Open
arBmind opened this issue Jan 22, 2021 · 1 comment
Open

Add replacements for QML_ELEMENT macro and friends #83

arBmind opened this issue Jan 22, 2021 · 1 comment

Comments

@arBmind
Copy link
Collaborator

arBmind commented Jan 22, 2021

Qt5.15 introduced new macros to register QObject with the Qml type system.
See "QtQml/qqml.h" header:

  • QML_ELEMENT
  • QML_SINGLETON
  • QML_NAMED_ELEMENT(name)

All these macros use Q_CLASSINFO internally. This can also be done with Verdigris.

Ideas and help is more than welcome!

@arBmind arBmind changed the title Add QML_ELEMENT and friends Add replacements for QML_ELEMENT macro and friends Jan 22, 2021
@arBmind arBmind mentioned this issue Aug 7, 2022
@arBmind
Copy link
Collaborator Author

arBmind commented Aug 7, 2022

My current state of analysis is:

  • The QMetaObject part is quite easy. (I can do that part in an hour or two)
  • But we need some build system support to generate the necessary *_qmltyperegistrations.cpp and *.qmltypes. Qt deploys an army of CMake scripts to invoke moc multiple times to get all these. So far we do not even have CMake build support in the Verdigris project. (QMake cannot do that. I doubt it will be easy in Qbs.)

My sketchy plan:

  1. Add CMakeLists.txt to Verdigris.
  2. Create a Verdigris replacement for qt_add_qml_module.
    • This will require a deep knowledge of CMake and some inspiration from the cmake tools provided by Qt.
  3. Use compiler defines to build an qmltyperegistrations.cpp equivalent.
    • Option A: build an executable that when executed generates the .cpp file.
    • Option B: generate the #include statements with CMake and use some local type registration to effectively do the same.
    • Option C: generate the .json compatible to moc and use qmltyperegistrar to build the qmltyperegistrations.cpp.
  4. Once this works use some clever tricks to build an executable that generates the qmltypes.

Seems kinda impossible.

@arBmind arBmind mentioned this issue Jan 1, 2023
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant