The main code that is automatically generated is usually something like:
int main(int argc, char *argv[])
{
QmlApplicationViewer viewer;
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.showExpanded();
return app.exec();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QmlApplicationViewer viewer;
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/testapp/main.qml"));
viewer.showExpanded();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
and the implementation for showExpanded() is:
void QmlApplicationViewer::showExpanded()
{
#ifdef Q_OS_SYMBIAN
showFullScreen();
#elif defined(Q_WS_MAEMO_5)
showMaximized();
#else
show();
#endif
}
void QmlApplicationViewer::showExpanded()
{
#ifdef Q_OS_SYMBIAN
showFullScreen();
#elif defined(Q_WS_MAEMO_5)
showMaximized();
#else
show();
#endif
}
To copy to clipboard, switch view to plain text mode
Which means that in the simulator you are calling show() method to show the UI. Instead of doing that you should call showFullScreen() for the simulator as well, for example by changing the implementation of main (because that file is not updated automatically when QtCreator is updated!):
int main(int argc, char *argv[])
{
QmlApplicationViewer viewer;
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
#if defined QT_SIMULATOR
viewer.showFullScreen();
#else
viewer.showExpanded();
#endif
return app.exec();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QmlApplicationViewer viewer;
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/testapp/main.qml"));
#if defined QT_SIMULATOR
viewer.showFullScreen();
#else
viewer.showExpanded();
#endif
return app.exec();
}
To copy to clipboard, switch view to plain text mode
That should do the work.
Bookmarks