Qt How to make and install plugins?

2019-03-30 10:11发布

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).

2条回答
对你真心纯属浪费
2楼-- · 2019-03-30 10:35

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

Hope this helps!

查看更多
爱情/是我丢掉的垃圾
3楼-- · 2019-03-30 10:46

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

查看更多
登录 后发表回答