The goal is to come up with a way to protect your QML code from plagiarism. This is a problem, since the QML path has been designed and implemented, it seems inexplicably insecure in this regard. The only types of QML that are somewhat protected are those that are fully implemented in C ++.
- Qt resource files do not support any degree of protection.
- even if you are compressing a resource file, extracting data from it is still pretty trivial for anyone with moderate experience
- QML files stored in the file system practically exist for acceptance
- the same applies to any remote QML files, in addition to adding an Internet connection dependency, itβs easy to sniff network access and receive QML files through their URLs.
- QML does not seem to provide any public API to allow users enough control over the QML type to protect their code.
All in all, it seems that Qt intentionally refuses to protect QML code, one obvious candidate reason is to get people to buy an insanely expressive commercial license that has a QML compiler.
Thus, there is no stock method to protect QML sources, the only solution that comes to my mind right now is to control how QML types are resolved. There are several ways to register types in QML:
- register in the executable application
- register in the plugin
- registered through the QML module
However, I need to manually QQuickImageProvider QML types, just as you can create a custom QQuickImageProvider that enters a URL string and displays an image, I need a QML mechanism to request a string with a type in my regular component provider, which displays the readiness component for creating an object .
It would be easy if some kind of custom instance creation mechanism was used, but I need those types that can be used in regular QML sources. Ideally, this should be the first mechanism used to resolve the type before looking for available import paths or even internal registered types.
Alternatively, it would also be useful if there was a way to fully define a QML module completely in C ++ without any external QML files without a qmldir file, etc.
As a last resort, and ideally I do not agree, I would also agree to register QML types (not C ++) for the runtime, this can also be useful, but I would prefer to have full control over the resolution process.
The QML plugin does not do the trick, since it registers C ++ types, and I want to register QML types, i.e. QQmlComponent , created from string sources and referencing each other.