Hello,

Could someone please explain how to handle pop-up in the Android platform correctly?

I have been trying to port a desktop application to Android using Qt5.1. It has been very easy to get the first build and run the application on a tablet. The basic functionality worked straight out of the box but I am having immense problems with Dialogues and pop-ups such as QMessageBox and the QCalendarWidget triggered by QDateTimeEdit.

It seems that every window is placed on the top left corner by default. There has been suggestions that it is possible to move Message box using the desktop information in QDesktopWidget. Something like this:

QRect screen = QApplication::desktop()->screenGeometry();
move((screen.width()-width())/2, (screen.height()-height())/2);

In my experience this works for QDialog if it is used in the constructor but not in any other place. As for QMessageBox, nothing seems to work. It was suggested that the same trick works in Qt5.0 if used after the widget is shown, but it does not seems to be the case any more.

There seems to be a problem with pop-up sizes as well. Most pop-ups are squashed to a very small part of the top left corner. When possible I tried to enforce minimum size which helped in most cases but there is no replacement for the built in size management on the desktop platform. Since my tablet has a 1280x756 screen, I could have used the desktop gui correctly in most cases. However it does not seem to be possible due to all pop-ups needed rewriting.

Eventually I reimplemented QMessageBox from scratch using QDialog, however all the other built in pop up are misbehaving. There are progress dialogues and the most problematic is the calander pop up form QDateTimeEdit.

Is there a way to settle the size and position of all pop-ups globally? I understand the Android has no window manager but the operating system itself uses pop-ups. Qt must provide some means to display pop-up in the middle of the screen, as opposed to middle of the window on desktop.

I am up against a clock so, any suggestion is appreciated.

Regards,
Peter