QDeclarativeView no such file ot directory. Running QML and c++ application in qtCreator

kajojeq picture kajojeq · Oct 10, 2013 · Viewed 7.5k times · Source

What I am trying to do is test QML in qtcreator. I have newest version Qt Creator 2.8.1 based on Qt 5.1.1.

I would like to add qml to my c++ application. I tried many ways. The most reasonable look using QDeclarativeView but I can't include it.

in pro files I add

QT += core gui declarative

I tried add quick, qml aswell but then I still don't see qtquick or declarative libraries.

I can see Qt Quick 2 UI project in qmlViewer by go

Tools->external->qtquick->qmlviewer

When I try to build Qt Quick 2 Application(Built-in Types) I get 3x

"Cannot open include file "QtQuick/QQuickView" no such file or directory.

I want to do simple c++ application using qml thanks for any help. I read many tutorials but most of them start after build. I have problem with run application no qml code.

Answer

user1095108 picture user1095108 · Oct 10, 2013

You can't include it, because it's qt quick 1 and you'd like to use qt quick 2. To be able to include QDeclarativeView you need:

QT += declarative

in your .pro file.

Look at QQuickView for the qt quick 2 alternative, for which you need:

QT += qml quick

in your .pro file.