PDA

View Full Version : "Extra" buttons in Symbian emulator



finngruwier
19th August 2011, 12:10
I am developing my first Qt application which is targeted for Symbian and Harmattan platforms. I code it in QML with the default QMLApplicationViewer C++ code to start the app.

When I test the app in Symbian Emulator, two extra buttons are showed in the bottom of the screen, one without function and the other with an exit function. When I test on a physical device these buttons are not present. Why do they appear in the emulator, and can I somehow turn them off?

mvuori
19th August 2011, 23:11
Why do they appear in the emulator, and can I somehow turn them off?
I would suggest:
1) A bug.
2) Just forget them. There probably is nothing you can do about them, and nobody else probably will, or if they will, it will be in the next SDK -- after all, QML is a new thing so bugs are a natural thing, unfortunately.

tsp
20th August 2011, 06:12
The main code that is automatically generated is usually something like:



int main(int argc, char *argv[])
{
QApplication app(argc, argv);

QmlApplicationViewer viewer;
viewer.setOrientation(QmlApplicationViewer::Screen OrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/testapp/main.qml"));
viewer.showExpanded();

return app.exec();
}

and the implementation for showExpanded() is:



void QmlApplicationViewer::showExpanded()
{
#ifdef Q_OS_SYMBIAN
showFullScreen();
#elif defined(Q_WS_MAEMO_5)
showMaximized();
#else
show();
#endif
}

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[])
{
QApplication app(argc, argv);

QmlApplicationViewer viewer;
viewer.setOrientation(QmlApplicationViewer::Screen OrientationAuto);
viewer.setMainQmlFile(QLatin1String("qml/testapp/main.qml"));

#if defined QT_SIMULATOR
viewer.showFullScreen();
#else
viewer.showExpanded();
#endif

return app.exec();
}

That should do the work.

finngruwier
20th August 2011, 12:45
It did - thanks. Another way to do the same thing is to change the last bit of qmlapplicationviewer.cpp to:


void QmlApplicationViewer::showExpanded()
{
#ifdef Q_OS_SYMBIAN
showFullScreen();
#elif defined(QT_SIMULATOR)
showFullScreen();
#elif defined(Q_WS_MAEMO_5)
showMaximized();
#else
show();
#endif
}



I could be seen as a bug in Qt Creator that it doesn't do this automatically.

finngruwier
20th August 2011, 15:11
On the other hand: after having implemented the above, every time I now open the project Qt Creator tells me that qmlapplicationview.cpp is "modified" and asks me if I want to "update" it (i. e. reverse it to the original version). This is a bit annoying, so the solution proposed by tsp is better.