You mean something like this?
Q_OBJECT
public:
connect(pb, SIGNAL(clicked()), SLOT(onClick()));
l->addWidget(le1);
l->addWidget(le2);
l->addWidget(pb);
}
public slots:
void onClick(){
l->addWidget(lab);
lab->setText(le1->text()+" "+le2->text());
dlg.exec();
}
private:
};
class A : public QWidget {
Q_OBJECT
public:
A(QWidget *parent = 0) : QWidget(parent){
QVBoxLayout *l = new QVBoxLayout(this);
le1 = new QLineEdit;
le2 = new QLineEdit;
QPushButton *pb = new QPushButton;
connect(pb, SIGNAL(clicked()), SLOT(onClick()));
l->addWidget(le1);
l->addWidget(le2);
l->addWidget(pb);
}
public slots:
void onClick(){
QDialog dlg;
QVBoxLayout *l = new QVBoxLayout(&dlg);
QLabel *lab = new QLabel;
l->addWidget(lab);
lab->setText(le1->text()+" "+le2->text());
dlg.exec();
}
private:
QLineEdit *le1, *le2;
};
To copy to clipboard, switch view to plain text mode
The other "form" is the dialog in this case...
Bookmarks