Qt 如何制作和安装插件? [英] Qt How to make and install plugins?

查看:22
本文介绍了Qt 如何制作和安装插件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用此处提到的 Qt Quick Components for Desktop:http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/

I would like to use the Qt Quick Components for Desktop mentioned here: http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/

作者给出以下安装说明:

The author gives the following installation-instructions:

由于所有这些都是作为 Qt 本身的插件开发的,因此您只需 Qt 4.7.2 SDK 即可开始使用.只需查看 http://qt.gitorious.org/qt-components/desktop并做相当于 qmake &&在您的系统上进行安装.

Since all of this is developed as a plugin to Qt itself, all you need to get started is the Qt 4.7.2 SDK. Just check out the http://qt.gitorious.org/qt-components/desktop and do the equivalent of a qmake && make install on your system.

我克隆了存储库,在命令行中对其执行了 qmakemingw32-makemingw32-make install.创建了一个新文件夹,其中包含文件 libstyleplugin.a 和 styleplugin.dll.

I cloned the repository, executed qmake, mingw32-make and mingw32-make install on it in the command-line. A new folder was created which includes the files libstyleplugin.a and styleplugin.dll.

我只是不知道该怎么处理它们.sample-qml-files(使用我尝试在此处安装的组件)在 QML-Viewer 中没有显示任何内容,这意味着它们没有正确安装.

I just don't know what to do with them. The sample-qml-files (using the components I try to install here) show nothing in the QML-Viewer, which means they aren't isntalled correctly.

那我该怎么办?(顺便说一句.我在 Windows 上).

So what am I supposed to do? (btw. I'm on Windows).

推荐答案

Hedge,我在 Linux 上做过,但我相信你也可以在 Windows 上做同样的事情.您已经构建了很好的插件.因为它似乎make install"并没有真正起作用(我们不要责怪巨魔 - 它只是一个实验项目),你需要手动完成.现在您需要执行以下操作:

Hedge, I've done that on Linux but I believe you will be able to do the same on Windows. You already built the plugin which is good. Cause it seems "make install" doesn't really work (lets not blame the trolls - its just an experimental project), you need to do that manually. Now you need to do the following:

  1. 无论您是否安装了 Qt,都在该目录中创建imports"目录.
  2. 在imports"目录中创建Qt/labs"目录,整体看起来像这样:YOUR_QT_DIR/imports/Qt/labs.
  3. 将components"目录从构建组件的director 复制到YOUR_QT_DIR/imports/Qt/labs",如下所示:YOUR_QT_DIR/imports/Qt/labs/components.
  4. 转到您构建组件的目录中的示例"目录.您将在那里找到 Browser.qml、Gallery.qml 和 Panel.qml 文件.在文本编辑器中打开说 Gallery.qml 并替换顶部的以下两行:

导入../components"

导入../components/plugin"

导入 Qt.labs.components 1.0

保存更改并在 qmlviewer 中运行 Gallery.qml.你应该可以运行它.

save changes and run Gallery.qml in qmlviewer. You should be able to run it.

您也可以将 Gallery.qml 中的导入语句保持原样,但这将依赖于您构建组件的相对目录,并且在其他任何地方都不起作用.

Also you could leave the import statements from Gallery.qml as they were but that would rely on the relative directory where you built the components and won't work anywhere else.

希望对你有帮助

这篇关于Qt 如何制作和安装插件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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