[Qt-qml] Multiple qml files in one .cpp

bea.lam at nokia.com bea.lam at nokia.com
Tue Aug 24 08:11:53 CEST 2010


On 21/08/2010, at 1:12 AM, ext Sulamita Garcia wrote:

> Hi
> 
> I'm following the SameGame example -  http://doc.qt.nokia.com/4.7-snapshot/qml-advtutorial.html. The example runs fine with qmlviewer, but I'm trying to generate a release for it. I have a main.cpp like this:
> 
> #include <QApplication>
> #include <QDeclarativeView>
> 
> int main(int argc, char *argv[])
> {
> 
>         QApplication app(argc, argv);
> 
>         QDeclarativeView view;
>         view.setSource(QUrl::fromLocalFile("samegame.qml"));
>         view.show();
> 
>         return app.exec();
> 
> }
> 
> And although the example works fine with qmlviewer, when I try to run samegame binary, it says: 
> file:samegame.qml:28:3: Button is not a type 
>                 Button { 
>                 ^ 
> 
> All the files are in the same directory. Do I need to create a resource file or is there something else I should be doing?


This certainly should work, and runs without problems for me. There may have been issues in previous snapshots or beta releases that have now been fixed.

regards,

Bea



More information about the Qt-qml mailing list