首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > QT开发 >

qml project中如何导入qt c++写的插件

2012-03-28 
qml project中怎么导入qt c++写的插件我有个qml project:usexx.pro:C/C++ codeimport QmlProject 1.1Proje

qml project中怎么导入qt c++写的插件
我有个qml project:
usexx.pro:

C/C++ code
import QmlProject 1.1Project {    mainFile: "usexx.qml"    /* Include .qml, .js, and image files from current directory and subdirectories */    QmlFiles {        directory: "."    }    JavaScriptFiles {        directory: "."    }    ImageFiles {        directory: "."    }    /* List of plugin directories passed to QML runtime */     importPaths: [ "com/xx" ]}


usexx.qml:

C/C++ code
import QtQuick 1.0import com.xx 1.0Rectangle {    width: 360    height: 360    }


com/xx目录下的qmldir文件:
plugin chartsplugin .


怎么没法导入com/xx目录下的插件? 提示:module "com.xx" is not installed


com/xx下的.dll文件有plugin project代码生成:
其中的相关代码如下:
C/C++ code
void ChartsPlugin::registerTypes(const char *uri){    qmlRegisterType<PieChart>("com.xx", 1, 0, "PieChart");    qmlRegisterType<PieSlice>("com.xx", 1, 0, "PieSlice");}Q_EXPORT_PLUGIN2(chartsplugin, ChartsPlugin);



[解决办法]
可以参考我以前写的一篇blog
http://xzis.me/2010/10/hybrid-application-using-qml-and-qt-c/

热点排行