Qt How to send string between multiwindows

  • thing is I have a three screen first is main screen second is password third is setting
    So I made pushbotton when click need password then setting page will come up
    So I don't know how to make the String which typed in setting screen to be sent to main page
    I dont want to use like MainWindow *mian = new MainWindow
    I hope it can keep the mainwindow

  • This question has now been asked 75891677409385038 times here.

    • If the dialog is modal call QDialog::exec from mainwindow and if it returns QDialog::Accepted use getters you create in the dialog to access the relevent information.
    • If the dialog is modless create a signal connected to a slot in the mainwindow and use its arguments to pass the data around

  • @VRonin Thanks for your reply I try the following code:


    and my emit is :
    void sending::on_pushButton_clicked()
    QString data1= ui->lineEdit->text();



    this is noting wrong in it but not work
    could you do me a favor to look at this ??

  • thanks for your reply I tried to use emit(sendData(data1));
    still not working

  • Could you define "not working". does it crash? does it fail to compile? etc.
    Did you check your connect statement is correct? either by putting Q_ASSUME() around it or using Qt5 connect syntax?

  • @Tofu_panda
    pls show your full code

  • @Tofu_panda ,

    You should use,
    emit sendData(data1);

Log in to reply

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