QDialogs + Back Button = App Crash!

123 views
Skip to first unread message

Gustavo González

unread,
Feb 28, 2013, 10:45:35 AM2/28/13
to andro...@googlegroups.com
If your Qt app has these features:

1. Use QDialog objects
2. Include the support to the Android Back Button to close the dialogs

Then you can reproduce the issue following these steps:
1. Open your app
2. Open your QDialog
3. Press any part/component of your dialog
4. Press the Android Back Button to close the dialog
5. Crash!

Here is a bug report very related to this issue:

http://old.nabble.com/-Necessitas---Bug-315499--New%3A-KEYCODE-BACK-crashes-app-when-QComboBox-was-last-selected-td35045409.html

Note: if you never touch the QDialog and press the Back Button, there is no crash. If you include your own "Close" button inside the QDialog, there
is no crash.

Any suggestion about this bug? Any hint?

Thank you!



Sebastian Diel

unread,
Feb 28, 2013, 11:50:38 AM2/28/13
to andro...@googlegroups.com
Hi,
just disable AutoDefault for all Buttons on your Dialog.
This has bugged me, too... :-)

br
Sebastian
--
You received this message because you are subscribed to the Google Groups "android-qt" group.
To unsubscribe from this group and stop receiving emails from it, send an email to android-qt+...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Gustavo González

unread,
Feb 28, 2013, 12:00:44 PM2/28/13
to andro...@googlegroups.com
Hello there! :)

Question: even for a QDialog without buttons, the app crashes.
What to do in those cases?

i.e.: A dialog with a non-editable QTextEdit object. If I touch on any
part of it and then push the back button, the app crashes :S

Any way, thanks for your suggestion! :)

Joshua Grauman

unread,
Feb 28, 2013, 1:32:09 PM2/28/13
to andro...@googlegroups.com
It could be possible that the dialog isn't activated and the back event is being sent to the main window? That was happening to me. Try calling activateWindow() on the dialog?

Josh

Gustavo González

unread,
Feb 28, 2013, 8:41:31 PM2/28/13
to andro...@googlegroups.com
Well... you were right! It works! :D

This is the way how I avoided the bug:

void MyQDialog::keyPressEvent(QKeyEvent *event)
{
    if (event->key() == Qt::Key_MediaPrevious) {
        activateWindow();
        raise();

        close();
    }
}

PS: Anyway, this seems to be a workaround. Those lines should not be needed.
I hope the developers fix this bug in further versions of Necessitas :)

Reply all
Reply to author
Forward
0 new messages