How to integrate c++ and qt quick(qml)
-
Your code has one C++ mistake:QDeclarativeItem* item = qobject_cast<QDeclarativeItem*>(myObject);
You will see nothing with your corrected code though. You must create scene for showing QML in it. I have no handy example for this but Vass presented simplified way to show QML in C++ code. Just follow the Vass code. When you master it you can move further to more complex examples with your own created scenes, if you will need any. But at the moment it would be better to use pre-created QDeclarativeView for comprehending rudiments of C++ and QML relationship. -
ixsci
By using Vass code
I getting fllowing errors
1.C:\Qt\qtcreator-2.0.94\intgmobile-build-simulator/../intgmobile/main.cpp:14: error: undefined reference to `_imp___ZN16QDeclarativeViewC1EP7QWidget'2.C:\Qt\qtcreator-2.0.94\intgmobile-build-simulator/../intgmobile/main.cpp:18: error: undefined reference to `_imp___ZN16QDeclarativeView9setSourceERK4QUrl'
3.:-1: error: collect2: ld returned 1 exit status
-
imrrk, add
@QT += declarative@
to your .pro file.P.S. And please don't multipost.
-
imrrk What i version of Qt on your device? For Qt quick you need install "developers build Qt 4.7":http://wiki.forum.nokia.com/index.php/Qt_4.7_for_Symbian^3_-_developer_version.
-
[quote author="imrrk" date="1293685687"]Hi everyone
I tried with all the possibilities listed here...the example works fine in simulator but when i try to deploy it on device using Nokia Qt SDK i m getting error as follows1.DeclarativeView no such file or directory
[/quote]The latest Nokia Qt SDK available has support for Qt 4.6 only for release builds. So you cannot build QML app release with this SDK.