QML调用C++程序
1. 添加C++,MouseMemory文件(.h,.cpp)
2. 在main.cpp文件添加, qmlRegisterType<MouseMemory>("MouseMemory",1,0,"MouseMemory"); #第一个MouseMemory 为C++类型,第二个MouseMemory为QML导入名字,第三个MouseMemory为QML使用的类名
3.QML文件中导入 import MouseMemory 1.0
实例对象
MouseMemory{
id:mouseMemory
}
在事件中执行:
mouseMemory.test() #调用C++中的方法标签:调用,MouseMemory,C++,QML,mouseMemory,cpp From: https://www.cnblogs.com/shaoyang0123/p/17136125.html
参考:https://blog.csdn.net/hsy12342611/article/details/122910060