导入 QtQuick.Controls 2.1 未找到 QML 模块 [英] import QtQuick.Controls 2.1 QML MODULE NOT FOUND

查看:30
本文介绍了导入 QtQuick.Controls 2.1 未找到 QML 模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在 Windows 上使用基于 Qt 4.7.4(32 位)的 Qt Creator 2.4.1.我必须使用表视图在 QML 中创建一个表.当我尝试导入 QtQuick.Controls 2.1 时,我收到错误 QML MODULE NOT FOUND.基于 Qt 5.0.1 的 Qt Creator 2.6.2 出现同样的错误.任何帮助表示赞赏.

I am using Qt Creator 2.4.1 base on Qt 4.7.4(32 bit) on windows. I have to create a table in QML using Table View. When i try import QtQuick.Controls 2.1 i get the error QML MODULE NOT FOUND. Same error on Qt Creator 2.6.2 based on Qt 5.0.1. Any help appreciated.

推荐答案

模块 QtQuick.Controls 已添加到 Qt 5.1,目前在 1.0 版本.它还要求您拥有 QtQuick 2.0 版,与 Qt 5 一起引入因此,如果您想使用 TableView 您必须更新当前的 Qt 版本至少到 5.1 然后使用这些 import 语句:

The module QtQuick.Controls has been added on Qt 5.1 and is currently at the 1.0 version. It also requires you having QtQuick version 2.0, introduced with Qt 5 So if you want to use TableView you would have to update your current Qt version to at least 5.1 and then use these import statement:

import QtQuick 2.0
import QtQuick.Controls 1.0

此外,如评论中 Armaghast 所示,如果您要迁移到最新的 Qt 版本(当前为 Qt 5.2.1) 你应该使用

Also, as indicated by Armaghast in the comment, if you are moving to the latest Qt version (currently Qt 5.2.1) you should use

import QtQuick 2.2
import QtQuick.Controls 1.1

这篇关于导入 QtQuick.Controls 2.1 未找到 QML 模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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