安装 Qt Quick Components for Desktop 以与 Qt Creator 一起使用
我正在尝试使用 中的 Qt Quick Components for Desktop http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/
我可以将它构建并安装到它自己的文件夹中,并且使用 qmlviewer 查看 qml,但如何在 Qt Creator 中使用其他项目中的这些 qml 组件?
例如,我希望能够使用 Qt Quick Components for Desktop 中的 Dial.qml 在我的项目中的 qml 文件中创建 Dial 元素。
I'm trying to use Qt Quick Components for Desktop from http://labs.qt.nokia.com/2011/03/10/qml-components-for-desktop/
I can build and install it just fine into it's own folder, and view the qmls with qmlviewer, but how do I use these qml components from my other projects in Qt Creator?
For example, I'd like to be able to use Dial.qml from the Qt Quick Components for Desktop to make a Dial element in a qml file in my project.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我使用了这个问题的答案中的说明: Qt 如何制作和安装插件? 并能够在 qt 创建者 qml 文件中成功使用 qt 快速桌面组件。以下是我所做的更详细说明:
例如“C:\ Program Files \ Microsoft Visual Studio 9.0 \ VC \ bin \ vcvars32.bat”
您应该收到类似以下内容的消息:“正在设置使用 Microsoft Visual Studio 2008 x86 工具的环境”
例如 SET PATH=%PATH%;C:\Qt\qtcreator-2.1.0\bin
例如 SET PATH=%PATH%;C:\Qt\4.7.2\bin
qmake
乔姆调试
jom install
导入 Qt.labs.components #.#
其中 #.# 是您的版本号(例如 0.1)
I used the instructions from the answer for this question: Qt How to make and install plugins? and was able to successfully use the qt quick desktop components within qt creator qml files. Here are more detailed instructions that I made:
e.g. "C:\Program Files\Microsoft Visual Studio 9.0\VC\bin\vcvars32.bat"
You should receive a message similar to: "Setting environment for using Microsoft Visual Studio 2008 x86 tools"
e.g. SET PATH=%PATH%;C:\Qt\qtcreator-2.1.0\bin
e.g. SET PATH=%PATH%;C:\Qt\4.7.2\bin
qmake
jom debug
jom install
import Qt.labs.components #.#
where #.# is your version number (e.g. 0.1)
这些是使用 Windows 系统和 Qt 附带的 mingw 的替代步骤。对于本示例,我将 Qt SDK 安装到
C:\QtSDK
。对于这些说明,我使用了 Qt 4.8.1。;
,然后添加Qt的mingw bin目录的路径,本例中为C:\QtSDK\mingw\bin
;C:\QtSDK\Desktop\Qt\4.8。 1\mingw\bin
;C:\QtSDK\mingw\bin;C:\QtSDK\Desktop\Qt\4.8.1\mingw\bin
。请注意,这些路径也可以添加到路径变量中的任何位置,无论顺序如何。SET PATH=%PATH%;C:\QtSDK\Desktop\Qt\4.8.1\mingw\bin
添加Qt的桌面mingw bin目录SET PATH=%PATH%;C:\QtSDK\mingw\bin
添加Qt的mingw bin目录qmake && mingw-make install
C:\QtSDK\Desktop\Qt\4.8.1\mingw\imports\QtDesktop
所以不需要手动移动或创建任何文件夹。尝试编译并运行以下代码:
在执行这些指令时,QtDesktop 组件的最新版本是 0.1。要检查您安装的版本,请导航至
C:\QtSDK\Desktop\Qt\4.8.1\mingw\imports\QtDesktop
并使用文本编辑器打开文件qmldir
并注意每行的版本号。These are alternative steps using a windows system and mingw which comes with Qt. For this example, I installed the Qt SDK to
C:\QtSDK
. For these instructions, I used Qt 4.8.1.;
then the path to Qt's mingw bin directory, in this case it isC:\QtSDK\mingw\bin
;C:\QtSDK\Desktop\Qt\4.8.1\mingw\bin
;C:\QtSDK\mingw\bin;C:\QtSDK\Desktop\Qt\4.8.1\mingw\bin
. Note that these paths could also be added anywhere and whichever order within the path variable.SET PATH=%PATH%;C:\QtSDK\Desktop\Qt\4.8.1\mingw\bin
SET PATH=%PATH%;C:\QtSDK\mingw\bin
qmake && mingw-make install
C:\QtSDK\Desktop\Qt\4.8.1\mingw\imports\QtDesktop
so there is no need to manually move or create any folders.Attempt to compile and run the following code:
At the time of these instructions, the latest version of the QtDesktop components is 0.1. To check the version you installed, navigate to
C:\QtSDK\Desktop\Qt\4.8.1\mingw\imports\QtDesktop
and open the fileqmldir
with a text editor and notice the version number on each line.