Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [Solved] Cannot use QtQuick 2.0 in Visual Studio 2010 Express
Forum Updated to NodeBB v4.3 + New Features

[Solved] Cannot use QtQuick 2.0 in Visual Studio 2010 Express

Scheduled Pinned Locked Moved QML and Qt Quick
7 Posts 2 Posters 3.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    cristeab
    wrote on last edited by
    #1

    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)

    1 Reply Last reply
    0
    • C Offline
      C Offline
      cristeab
      wrote on last edited by
      #2

      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)

      1 Reply Last reply
      0
      • sierdzioS Offline
        sierdzioS Offline
        sierdzio
        Moderators
        wrote on last edited by
        #3

        find_package (Qt5Declarative)

        In QML2, you need to include QtQml and QtQuick modules - not QtDeclarative.

        (Z(:^

        1 Reply Last reply
        0
        • C Offline
          C Offline
          cristeab
          wrote on last edited by
          #4

          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 ?

          1 Reply Last reply
          0
          • sierdzioS Offline
            sierdzioS Offline
            sierdzio
            Moderators
            wrote on last edited by
            #5

            Yes, QQuickView.

            (Z(:^

            1 Reply Last reply
            0
            • C Offline
              C Offline
              cristeab
              wrote on last edited by
              #6

              This solves my problem. Thanks

              1 Reply Last reply
              0
              • sierdzioS Offline
                sierdzioS Offline
                sierdzio
                Moderators
                wrote on last edited by
                #7

                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.

                (Z(:^

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved