New window going behind the previous window when clicked

  • In my QT c++ app I create instances(3 in this scenario) of another window(Dialog) when a button int the MainWindow is released! The Dialog window also has a button and when its clicked a QStringList is to be sent to the initial window(MainWIndow)

    following is my code

    void MainWindow::receiveFIelds(QStringList a) {


    void MainWIndow::on_pushButton_3_clicked()

       for(int i=0;i<3;i++){
       Dialog *dialog1 = new Dialog();


    The code of Dialog is as follows!

    void Dialog::accept() {
    QStringList info;
    emit sendFields( info); // here we emit the signal
    When the Dialog window is created and the button in it is clicked the QStringList is to be sent to the initial MainWindow but when the mouse cursor goes over the DIalog window it hides behind the main window!
    How can I correct this?

  • Lifetime Qt Champion


    What version of Qt ?
    On what OS ?
    Are you doing anything with for example focus related events in your application ?

  • @SGaist QT 5.9 in windows 10! I doubt whether there is some connection between the mainwindow being a QDialog and the dialog form being QDialog can have an impact on this?

  • Qt Champions 2018

    @Lasith Why is your main window a dialog? How do you show main window? If you use exec() then it is a modal window.

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.