1

I would like to create a library of QML custom controls that I would provide to my customers. At the same time I don't want my customers to "reverse-engineer" my controls by peeking into the QML source code.

What are my best options to avoid this? The ideal scenario would that I provide my controls as a compiled library that they could import in their own projects.

My target platforms are iOS and Android.

BigONotation
  • 4,406
  • 5
  • 43
  • 72

3 Answers3

2

How can I create the package for custom QML controls? These controls should not be packaged in the source code form to prevent reverse-engineering.

The question implies that the author has QML custom controls implemented with QML technique itself (not C++). Otherwise that would be already QML C++ PlugIn and provided in the form compiled library or some other form of native code (we can just register QML type and provide the necessary import from within executable).

To implement QML PlugIn (with just QML source code) we should create special type of project. It is convenient to organize as nested subdir project to make it work altogether with the rest of the application. Mind that one plug-in project may contain many new QML types.

And to make QML code not visible we can now compile it with Qt Quick compiler available under certain Qt licenses.

Alexander V
  • 8,351
  • 4
  • 38
  • 47
0

When built for static linking, since 5.7 Qt will build QML modules as shared libraries, embedding the qml files as resources rather than using them from the file system. So that would be one way to go, go for a static Qt build and build your custom controls as a module.

Another potential, albeit far more complicated approach is already outlined here.

Community
  • 1
  • 1
dtech
  • 47,916
  • 17
  • 112
  • 190
  • Does packaging QML source code to statically built executable prevent it from being seen? I would open executable with some viewer utility then to find/see blocks of text. That format is compressed or obfuscated? – Alexander V Mar 04 '17 at 16:52
  • If you specify compression, it will compressed, and that's the best you can hope for, you will need to tweak the threshold settings to ensure as much of the qml files as possible gets compressed, some text will still be readable thou. As discussed in the second linked solution OP, QML offers absolutely no means of protecting the code from plagiarism, no obfuscation, no encryption, nothing whatsoever, and also nothing to protect from doing malicious changes to qml files deployed on the user system. – dtech Mar 04 '17 at 17:00
  • @ddriver I am not sure how to setup my project as you suggested. In Qt creator, I can create a plugin project, which is only C++. How do I setup a QML module project for static building? How do I reference it then in my main application project (assuming I am using QtCreator for both projects and have both of them open in my "workspace")? I also have Qt 5.8 installed, so using the qtquickcompiler tool could be a viable option – BigONotation Mar 04 '17 at 18:57
  • For my needs, having the QML source code embedded in a binary lib (shared or static) is acceptable. If the client goes as far as peeking into that lib he would be in breach of contract anyway (and to be honest I'm not sure the client would go that far). What I don't want to do is to "make things easy" by providing the QML readily available. – BigONotation Mar 04 '17 at 19:03
  • Well, it is not that simple. You will need a static Qt build to begin with. Then you will need to examine the implementation of the stock QML modules and do yours in the same manner, then build with your static build to produce the binary containing the QML files of the module. It is not just some option you can check and voila. Qt doesn't make those things easy for you ;) – dtech Mar 04 '17 at 21:48
0

QML files can be included in a QRC profile and used in the code with "qrc:/". When building, they are then included in the target binary, protecting them from indiscrete eyes.

Massimo Callegari
  • 2,099
  • 1
  • 26
  • 39