Reputation: 13
From my QMainwindow I am opening a second QDialog window when a pushbutton is pressed.This is my code
newFile = new Dialog(); if(fStatus == 0) { newFile.show(); fStatus = 1; } else if(fStatus == 1) { newFile.raise(); }
What I am trying to do is if the QDialog window is already open and the push button is pressed again I want my QDialog window to move to front.
I have tried same with Qwidget form it is working but Qdialog raise(); is not working,but in case of Qwidget I am not able not capture the Qwidget destroyed signal on closing of the widow properly.
Upvotes: 1
Views: 2628
Reputation: 1751
I didn't tested it but from what I read I found this :
yourQWidget->show();
yourQWidget->activateWindow();
yourQWidget->raise();
How to Bring the Widget Bring to front in QT?
QDialog *yourQDialog = new ...
yourQDialog->setWindowFlags(yourQDialog->windowFlags() | Qt::WindowStaysOnTopHint);
yourQDialog->show();
Also loook at this question: Bring window to front -> raise(),show(),activateWindow() don’t work
Upvotes: 5