[Solved] Cannot use QtQuick 2.0 in Visual Studio 2010 Express
-
Hi
I am using Qt5 for a project managed with cmake in Visual Studio 2010 Express. I am able to compile the project, but at run time I get the error:module "QtQuick" version 2.0 is not installed.
This is the CMakeLists.txt file I am using
if (WIN32)
set (CMAKE_PREFIX_PATH "C:/Qt/Qt5.0.0/5.0.0/msvc2010")
else()
set (CMAKE_PREFIX_PATH "/usr/local/Qt-5.0.0")
endif()find_package (Qt5Declarative)
include_directories (${CMAKE_SOURCE_DIR}/src ${QT_QTDECLARATIVE_INCLUDE_DIR})
set(CMAKE_AUTOMOC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)set (PRJ_HDRS src/window.h)
set (PRJ src/window.cpp src/main.cpp)
set (PRJ_RSC qml/res.qrc)
set (PRJ_MOCS src/window.h)QT5_ADD_RESOURCES (RSCS ${PRJ_RSC})
add_executable (${CMAKE_PROJECT_NAME} ${PRJ_SRCS} ${RSCS})
qt5_use_modules(${CMAKE_PROJECT_NAME} Declarative Qml Quick) -
using import QtQuick 1.0 solves this error, but I am still wondering why I cannot use QtQuick 2.0 when only Qt5.0.0 is istalled on my system (Win7)
-
find_package (Qt5Declarative)
In QML2, you need to include QtQml and QtQuick modules - not QtDeclarative.
-
I am not following, I use
qt5_use_modules(${CMAKE_PROJECT_NAME} Declarative Qml Quick)which should be enough. In my code I am using
QDeclarativeView::setSource(QUrl("file.qml"))
should I use another class for loading the QML document ?
-
Yes, QQuickView.
-
This solves my problem. Thanks
-
Great :) Please add [Solved] to the topic's title. There are also other header changes in Qt5, you can change them with fixqt4headers.pl tool, and/ or the "porting guide":http://qt-project.org/doc/qt-5.0/qtdoc/portingguide.html.