Qt 如何制作和安装插件?

发布于 2024-10-31 10:13:45 字数 717 浏览 5 评论 0原文

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

作者给出了以下安装说明:

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

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

我只是不知道该怎么处理它们。样本 qml 文件(使用我尝试在此处安装的组件)在 QML 查看器中没有显示任何内容,这意味着它们未正确安装。

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

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:

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.

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.

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.

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

情绪 2024-11-07 10:13:45

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

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

import "../components"

import "../components/plugin"

导入 Qt.labs.components 1.0

保存更改并在 qmlviewer 中运行 Gallery.qml。您应该能够运行它。

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

希望有帮助

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. Create "imports" directory inside the directory whether you installed Qt.
  2. Create "Qt/labs" directory inside that "imports" directory so overall it looks like this: YOUR_QT_DIR/imports/Qt/labs.
  3. Copy "components" directory from the director where you built the components to "YOUR_QT_DIR/imports/Qt/labs" so it looks like this: YOUR_QT_DIR/imports/Qt/labs/components.
  4. Go to "examples" directory in the directory where you built the components. You will find Browser.qml, Gallery.qml and Panel.qml files there. Open say Gallery.qml in a text editor and replace the following two lines on the top:

import "../components"

import "../components/plugin"

with

import Qt.labs.components 1.0

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

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.

Hope that helps

赤濁 2024-11-07 10:13:45

在 Windows 上,我的目录最终为 C:\QtSDK\Desktop\Qt\4.7.3\mingw。

希望这有帮助!

On Windows my directory ended up being C:\QtSDK\Desktop\Qt\4.7.3\mingw.

Hope this helps!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文