QuickVtk icon indicating copy to clipboard operation
QuickVtk copied to clipboard

make Core a QML module

Open maidamai0 opened this issue 5 years ago • 3 comments

I noticed all QML types like vtk.actor are registered to qmlengine by qmlRegisterType family functions in c++ code.Have you cansidered to make them a standalone QML module use qmldir so everyone can use it in QML like the native QML types without register it in c++ code.?

maidamai0 avatar Dec 19 '19 06:12 maidamai0

I'm not sure I understand correctly. The C++ classes are always necessary in order to use VTK types in QML. So you will always have a dependency to the C++ implementation and therefore the QuickVtk Core library. This is why I deliberately left type registration on the C++ side.

I assume you mean QML Plugins, right? That would be possible but the only advantage I can see is a better integration with QtCreator and .pro files. I'm not saying that this is not relevant. But I think it makes more sense to stick to CMake to handle project dependencies. Plus, QML Plugins are also just libraries, so I'm not too sure if moving the QuickVtk Core to such a plugin would really change things. But please correct me if I'm wrong since I didn't really spent too much time on this topic. I'm always happy for every single bit of feedback and fresh ideas!

qCring avatar Dec 19 '19 11:12 qCring

Yes, I mean QML Plugins.If QuickVtk Core is made to a QML Plugins, it will act like a native QML type just like Rectangle QML Type.Everyone who wants to use vtk in QML just need copy the qmldir file and the library file and add a path to QML Import Path.

Just like creating a QML bindings for vtk and I find this is convinent.With qmlplugindump you can give QtCreator code completion, again, like the native QML types :blush:.

maidamai0 avatar Dec 19 '19 12:12 maidamai0

Code completion is a good point though. Also, I just searched for Qt package managers (something like NuGet but for Qt) and found the qpm project (GitHub link). So yeah, there are some good reasons to consider QML Plugins. I'll keep this issue open for now and come back to this later. Right now, I'm working on a somewhat big refactoring to clean up the project and the GitHub Pages project documentation. Might take a bit but things are looking good. I'm planning on this to be done in the next week(s). After that I'll have some time for further research!

qCring avatar Dec 19 '19 12:12 qCring