ok, but when i click on ok button, the user and pass window does not close ! Then when I close the user and pass window manually, The main window opens.
ok, but when i click on ok button, the user and pass window does not close ! Then when I close the user and pass window manually, The main window opens.
Qt Code:
void setPass::on_pushButton_clicked() { setUsername(user = ui->userName->text()); setPassword( pass = ui->passWord->text()); accept(); // <<<<<<<<<<<< }To copy to clipboard, switch view to plain text mode
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
smemamian (20th April 2013)
Does not work,when i click ok button, the user and pass window is closed !
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
Why wouldn't it be closed?
@amleto: I think he doesn't want to close the dialog until the user explicitly requests so. Which doesn't make much sense but I think that's OP's idea...
going back to this
Qt Code:
#include "mainwindow.h" #include <QApplication> #include "dialog.h" #include "setpass.h" int main(int argc, char *argv[]) { setPass pas ; pas.show(); if(pas.setBool()) { MainWindow w; pas.close(); w.show(); } // what do you think has happened to 'w' here? Answer: it does not exist. return a.exec(); }To copy to clipboard, switch view to plain text mode
Qt Code:
#include "mainwindow.h" #include <QApplication> #include "dialog.h" #include "setpass.h" int main(int argc, char *argv[]) { setPass pas ; pas.exec(); // exec not close if(pas.setBool()) { MainWindow w; //pas.close(); // this is already closed w.show(); return a.exec(); } return 1; }To copy to clipboard, switch view to plain text mode
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.
smemamian (20th April 2013)
i changed :
Qt Code:
void setPass::on_pushButton_clicked() { setUsername(user = ui->userName->text()); setPassword( pass = ui->passWord->text()); if(setBool()) accept(); }To copy to clipboard, switch view to plain text mode
Thank you all.
Last edited by smemamian; 20th April 2013 at 19:56.
Bookmarks