how to send data from a window object back to mainwindow



  • Hi all

    I have an application with a main window, complete with ui.

    Now I open a dialog window doing some operations and generating values that I want to insert into some fields in the mainwindow.ui

    How can I send these values back to the mainwindow.ui?

    New window object:
    Messung::Messung(QWidget *parent, Kurve kurve, Betriebspunkt betriebspunkt, QVector<QVector<double> > messwerte) : QDialog(parent), ui(new Ui::Messung){
        ui->setupUi(this);
        this->setWindowTitle("Messung");
        // generating data here
    }
    

    Can I write data to the parent window fields by clickng on a button in the dialog window?

    Thanks in advance,
    Thomas


  • Lifetime Qt Champion

    Hi,

    It all depends on the lifetime of your dialog.

    Usually, you give getters and setters to your dialog and set it up before showing it from the MainWindow, then once done, you grab the data you want from it and modify your MainWindow using the getters.



  • I made it! Finally i understood signals and slots!


Log in to reply
 

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