Hi
I need to close the dialog box using a button. I have 4 line edits and i need to save the values into a variable before closing the dialog.
I have a mainwindow and a dialog.
this is my code, to open the dialog b4 the main window.
void desktop::newdevice()
{
Ui::newdevice newui;
newui.setupUi(&dlg);
identityreaddata();
dlg.setWindowTitle("Title");
newui.statuslabel->setText("Please enter the details");
//if(dev_email == '\0' || dev_serialno == '\0'|| dev_devicename == '\0' )
{
if(dlg.
exec()== QDialog::Accepted);
{
devicename = newui.devnameEdit->text();
password = newui.passEdit->text();
email = newui.emailEdit->text();
slno = newui.slnoEdit->text();
qDebug () << "device name"<<devicename;
qDebug () << "password"<<password;
qDebug () << "email"<<email;
qDebug () << "slno"<<slno;
connect(newui.
updateButton,
SIGNAL(clicked
()),
SLOT (QDialog::close()));
}
void desktop::newdevice()
{
QDialog dlg;
Ui::newdevice newui;
newui.setupUi(&dlg);
identityreaddata();
dlg.setWindowTitle("Title");
newui.statuslabel->setText("Please enter the details");
//if(dev_email == '\0' || dev_serialno == '\0'|| dev_devicename == '\0' )
{
if(dlg.exec()== QDialog::Accepted);
{
devicename = newui.devnameEdit->text();
password = newui.passEdit->text();
email = newui.emailEdit->text();
slno = newui.slnoEdit->text();
qDebug () << "device name"<<devicename;
qDebug () << "password"<<password;
qDebug () << "email"<<email;
qDebug () << "slno"<<slno;
connect(newui.updateButton, SIGNAL(clicked()),SLOT (QDialog::close()));
}
To copy to clipboard, switch view to plain text mode
but when i press the update button, the dialog doesnt close. I have to press the x button on the right top corner to close it.
Can somebody help me with this??
Bookmarks