[Tips] C++ plugin to QML
来源:互联网 发布:西门子840dsl编程手册 编辑:程序博客网 时间:2024/06/08 06:51
1、使用项目创建工具,创建QtQuick2 Plugin工程。
2、有两个名字很重要。
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style="font-size:18px;"><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">@uri</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">MyPlugin</span></span>
<span style="font-size:18px;">qmlRegisterType<<strong>ComManager</strong>>(<strong>uri</strong>, 1, 0, "<strong>ComManager</strong>");</span>
QML中的写法是 import MyPlugin 1.0,然后在代码里面写 ComManager{...}。
3、生成dll文件,和qmldir文件。qmldir文件内容如下:
module MyPlugin
plugin ComManager
两个文件放在一个新建的文件夹下,文件夹名字为MyPlugin
4、调试代码时,把MyPlugin文件夹放在exe文件同级目录下,QML才能install plugin。因为是动态调用嘛~~
0 0
- [Tips] C++ plugin to QML
- C Tips: Convert GBK to Unicode
- 《Basic C Plugin How-To 》学习笔记
- qml XmlListModel plugin not found
- 10 Tips to make Your C Program Effective
- 10 Tips to Make Your C Program Effective
- C Tips: Convert LPCTSTR to UTF-8 string
- C Tips: Convert GBK to Unicode (base on MultiByteToWideChar ())
- C tips
- c++,tips
- C tips
- C tips
- C Tips
- tips to include tcmalloc
- Introduction to the QML Language
- gem to plugin
- Qt5:QML:Invalid write to global property QML
- C Tips: How to tell if system is little endian or big endian?
- Netty官方指南: User guide for 4.x
- hpu 1897 CZY找句子
- 英语学习
- curl
- 记我的WiFi音箱之一个网络在线播放及本地播放音乐器(四)
- [Tips] C++ plugin to QML
- 几道周赛题目(bfs,dfs,kmp,快速幂运算,并查集)
- html中含提示文字的输入框
- 202Happy Number
- 周赛2-F
- MySQL 中间表的使用语法记录
- Linux网卡数据包的接收
- 单链表操作
- 路径的写法