Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //contactdialog.cpp
- QLabel* ContactDialog::getNameLabel(){
- return ui->nameLabel;
- }
- QLabel* ContactDialog::getAgeLabel(){
- return ui->ageLabel;
- }
- //mainwindow.cpp
- void MainWindow::on_buttonBox_accepted()//auto connected signal-slot
- {
- ContactDialog *cd = new ContactDialog();
- //get the labels from the contactdialog widget using it's accessor methods!!
- //then set the text user has entered from the mainwindow widget to it's labels!!
- cd->getNameLabel()->setText(ui->agelineEdit->text());
- cd->getAgeLabel()->setText(ui->namelineEdit->text());
- cd->show();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement