如何在 QML 中打包自定义控件? [英] How to package custom controls in QML?

查看:22
本文介绍了如何在 QML 中打包自定义控件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个 QML 自定义控件库,并提供给我的客户.同时,我不希望我的客户通过查看 QML 源代码来逆向工程"我的控件.

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.

我的目标平台是 iOS 和 Android.

My target platforms are iOS and Android.

推荐答案

如何为自定义 QML 控件创建包?这些控件请勿以源代码形式打包,以防逆向工程.

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.

问题暗示作者使用 QML 技术本身(不是 C++)实现了 QML 自定义控件.否则,这已经是 QML C++ PlugIn 并在形成编译库或其他形式的本机代码(我们可以只注册 QML 类型并从可执行文件中提供必要的导入).

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).

实现 QML 插件(仅使用 QML 源代码)我们应该创建特殊类型的项目.将其组织为嵌套的 subdir 项目 很方便,以使其与应用程序的其余部分一起工作.请注意,一个插件项目可能包含许多新的 QML 类型.

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.

为了让 QML 代码不可见,我们现在可以使用 Qt Quick compiler 编译它某些 Qt 许可证.

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

这篇关于如何在 QML 中打包自定义控件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆