Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
5.9.9, 5.15.0 RC2
-
None
-
Windows 10 Pro 64-bit
Description
I have a main window A which opens a child dialog B and this child dialog opens another child dialog C (i.e. a grandchild of the main window). Then the dialog B is deleted. This deletes also dialog C, which is correct AFAIK. But the problem is that after this, the main window is automatically sent to back of other windows which are currently open on the desktop.
My code:
#include <QApplication> #include <QDialog> #include <QTimer> int main(int argc, char *argv[]) { QApplication a(argc, argv); QWidget windowA; windowA.show(); auto dialogB = new QDialog(&windowA); dialogB->show(); auto dialogC = new QDialog(dialogB); dialogC->show(); QTimer timer; timer.setSingleShot(true); timer.start(1000); QObject::connect(&timer, &QTimer::timeout, dialogB, &QDialog::deleteLater); return a.exec(); }
To sum up the outcome: the main window A is still existing but disappears and gets hidden behind other windows of other processes. This is quite unexpected.
Expected result: main window A is visible as it was before deleting its children.
PS: This might seem as a very artificial example. My use case is however quite natural. Dialog B represents a progress dialog of a background thread. This dialog has "abort" button in it. Pressing this button will open a question dialog asking "do you really want to abort this task?". But when the background task is finished while dialog C is still open, then dialogs get destroyed. And main window disappears behind other windows.
Attachments
Issue Links
- relates to
-
QTBUG-129251 Deletion of a modal parent changes the window position of grandparent.
-
- Reported
-