QT5-为桌面安装Qt快速组件

时间:2014-11-24 12:38:09

标签: qml qt-creator qt5 qqmlcomponent

使用QT5时,Qt Quick Components for Desktop存在一些安装问题。

以下是我遵循的步骤(基于these instructions):

  1. http://qt.gitorious.org/qt-components/desktop/trees/master下载tar.gz,然后解压缩组件。

  2. 添加到环境变量中的PATH变量值(操作系统:Windows 8)C:\Qt\Qt5.3.1\5.3\msvc2012_opengl\bin;C:\Qt\Qt5.3.1\Tools\QtCreator\bin;

  3. 运行vcvars32.bat脚本(Visual Studio 2012)。

  4. qmake && nmake install文件夹中执行命令\qt-components-desktop\components

  5. qmake && nmake install文件夹中执行命令:\qt-components-desktop\src。此命令已自动将已编译的组件文件复制到QT导入文件夹。

  6. 在步骤 5 期间,我收到了以下错误:

    fatal error C1083: Cannot open include file: 'QtGui/qmenu.h': No such file or directory
    fatal error C1083: Cannot open include file: 'QtGui/qmenu.h': No such file or directory
    fatal error C1083: Cannot open include file: 'QtGui/qgraphicsitem.h': No such file or directory
    fatal error C1083: Cannot open include file: 'QtGui/QStyle': No such file or directory
    .\qdeclarativefolderlistmodel.cpp(162) : error C3861: 'setRoleNames': identifier not found
    fatal error C1083: Cannot open include file: 'QtGui/QStyle': No such file or directory
    fatal error C1083: Cannot open include file: 'QtGui/qgraphicssceneevent.h': No such file or directory
    fatal error C1083: Cannot open include file: 'QtGui/QAction': No such file or directory
    fatal error C1083: Cannot open include file: 'QtGui/QApplication': No such file or directory
    Generating Code...
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\cl.EXE"' : return code '0x2' Stop.
    NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\BIN\nmake.exe"' : return code '0x2' Stop.
    

    我理解这些错误是因为源代码是针对QT4而发生的,这些包括减速(如QtGui/QApplication)在QT5中不再存在。

    我搜索了很多,但我找不到如何为QT5下载此插件,如QT4的http://qt.gitorious.org/qt-components/desktop/trees/master

    有什么想法吗?或者我错过了另一个问题?

1 个答案:

答案 0 :(得分:2)

我在QT5中找到了替代组件:

根据this wikiQt Quick Controls取代了前者Qt Desktop Components。因此,在将QML代码从QT4.x移植到QT5.x时使用这些组件时,您需要用import Qt.labs.components *version*替换QML文件中的import QtQuick.Controls *version*

希望这会对某人有所帮助......