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) {
    List=a;

    }

    void MainWIndow::on_pushButton_3_clicked()
    {

       for(int i=0;i<3;i++){
       Dialog *dialog1 = new Dialog();
    
      connect(dialog1,SIGNAL(sendFields(QStringList)),this,SLOT(receiveFields(QStringList)));
    
    
       dialog1->show();
       }
    

    }

    The code of Dialog is as follows!

    void Dialog::accept() {
    QStringList info;
    info<<"I"<<"am"<<"john";
    emit sendFields( info); // here we emit the signal
    QDialog::accept();/
    }
    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

    Hi,

    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?


  • Moderators

    @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.