Difference between qtquickcompiler and new JIT.qmlc cache?

I got a little confused in qtquickcompiler, JIT qml caching and what is available (and what is not) in the open source version qt 5.8 (5.9, respectively).

Basically, I want to protect my .qml and .js files from reading in my release build. I started a new QtQuick sample project without editing any code. I followed these and added CONFIG + = qtquickcompiler to the .pro file, but it has no effect.

My .qml files are embedded in .exe (on Windows), but if they look in the executable, for example. with notepad ++, I still see the source code of the .qml files.

On the other hand, if I do not use QRC for my .qml files, .qmlc files are created for each of my .qml at runtime. These files are not (easy?) Readable. But I did not find a way to use only .qmlc files without sending .qml files in my assembly (and I don’t think it should have been like that).

Returning to my question: Is there a way to protect my open source qt .qml and .js files? And what is the difference between qtquickcompiler and new JIT.qmlc?

+5
source share
3 answers

No, it was, but then they abandoned these plans and replaced it with caching.

I do not think that you can reuse .qmlc files on another computer, since IIRC they are not portable architecture.

In the future, it should be possible to compile .qml to .qmlc and combine them into a binary application file.

If your files are on the file system, then there is no way to protect them from reading, reverse engineering, or being modified .

With the compiler, QML code is translated into C ++ code, which is then compiled into its own binary file. Also, the last time I checked if you go to the compiler, this is an β€œor / or” situation, if you use compiled qml, you can only use compiled qml, so do not mix with regular qml files. It is also ahead of time and requires a commercial license.

Qml caching, unlike time, is accurate (possibly in the future), does not require a commercial license and does not have restrictions that do not allow the use of regular qml files. I do not know the implementation details, but this is certainly not qml code translated into C ++ and then compiled as it happens on the client side, and does not require Qt or even a C ++ compiler. It is also not like bytecode, since IIRC is not compatible with binary systems between platforms, it is more like caching the result of processing qml files so that it does not execute it every time.

As pointed out in this answer , with some additional work, it would be possible to implement decent protection, for example, encrypted QML files or binary resources, but I still did not dig into it.

Finally, if you set the compression for a low threshold qrc file, it will somewhat confuse the QML code in the binary executable, but even then it is regular zip compression, so if your code is really worth stealing, it really won't stop it. just make it less trivial.

+1
source

Is there a way to protect my open source qt .qml and .js files?

Not yet. Prior to (and including) 5.8, you will need to buy a license in order to use the QML compiler.

And what is the difference between qtquickcompiler and new JIT.qmlc?

That the compiler will turn QML into C ++, which is then compiled into your application. .qmlc files are the cache generated by the engine to avoid parsing / optimization / etc. Same files. However, this is a cache - you will need to use the original source if they will not be used. There were some discussions at the Qt Contributors' Summit 2016 on how to optimize and integrate the compiler with the cache, but nothing exists yet.

+1
source

Coming to my question: is there any way to protect my open source qt .qml and .js files?

Yes, of course, look at my answer: fooobar.com/questions/1240707 / ... You can use the encriptied resource file, decrypt it at runtime ... I do this in all my projects ... This is not a trivial job, but it works great.

+1
source

All Articles