I have a mainwindow it can do some search from MySQL, eg. if I enter "abc", it will search all email with "abc" inside, then it will insert all result to a QTableWidget and show it, if i double click any of it, it will create a QDialog by show() and pass that email I clicked by SIGNAL/SLOT, the problem is, i want to create multiple QDialog if necessary. By double clicking another email, it should create another QDialog, but every time I open a new QDialog, all email I pass in will change to the last one I clicked, hope someone can teach me whats going on.
Here is my mainwindow double click function
void MainWindow::on_tableWidget_cellDoubleClicked(int row, int column)
{
auto resule = ui->tableWidget->item(row, 1);
Dialog* dialog = new Dialog(this);
connect(this, SIGNAL(sendTargetEmail(QString)), dialog, SLOT(receiveTargetEmail(QString)));
dialog->show();
emit sendTargetEmail(resule->text());
}
Here is my QDialog function
Dialog::Dialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::Dialog){
ui->setupUi(this);
label1 = new QLabel("Email:", this);
label1->setGeometry(10, 30, 50, 20);
emailLabel = new QLabel(this);
emailLabel->setGeometry(60, 30, 160, 20);
}
void Dialog::receiveTargetEmail(QString email){
m_email = email ;
emailLabel->setText(m_email);
}