PDA

View Full Version : QQmlApplicationEngine crashing (QT5 and VS 2010)



leonardo.massei
28th January 2014, 14:09
Hi to all,
I'm coding a simple QT5 program that it uses QQmlApplicationEngine class
to load a .qml file (Windows platform and Visual Studio 2010); the code is
the following:

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QQmlApplicationEngine engine("c:\\myfile.qml");
QObject *topLevel = engine.rootObjects().value(0);
QQuickWindow *window = qobject_cast<QQuickWindow *>(topLevel);

if ( !window ) {
qWarning("Error: Your root item has to be a Window.");
return -1;
}
window->show();
return a.exec();
}

when I try to execute (debug mode) the code, the application stop in
'QQmlApplicationEngine engine("c:\\myfile.qml");' line, and the VS2010
shows the msg box:

unhandled exception 0x00f79010 in provaQt.exe: 0xC0000005:
access violation reading location 0x00000004

Why ? Is this a qt bug .... ?

Best Regards
Leonard