[Qt-interest] Save and display user-entrys from a dialog

Sandro Frenzel Sandro.Frenzel at gmx.de
Fri Mar 13 15:04:51 CET 2009


Hello,


I have created a simple project with the Qt Creator. It contains a MainWindow with a button to open a dialog. This dialog displays some lineEdits for the user-input.

Now I want to display the input from the Dialog in a table-widget in the MainWindow. I write the following code. Remember, it is only for testing:

void MainWindow::on_pushButton_clicked()
{
    Dialog *newDataDlg = new Dialog(this);
    // Displays the Dialog
    newDataDlg->exec();
    // contain entrys?
    if(newDataDlg->getEntrysObject()->check()) {
        ui->tableWidget->insertRow(ui->tableWidget->rowCount());
        // Get input-element name
        ui->tableWidget->setItem(0, 0, new QTableWidgetItem(newDataDlg->getEntrysObject()->getName()));
    }

    delete newDataDlg;    
}

The getEntrysObject-Method gives me the object from the entrys-class, which manage the user-input.
Is this the right way to get data from a dialog in other windows?



Thanks and bye,
Sandro
-- 
Psssst! Schon vom neuen GMX MultiMessenger gehört? Der kann`s mit allen: http://www.gmx.net/de/go/multimessenger01



More information about the Qt-interest-old mailing list