i have a QDialog, frmLogin, which allows a user to well, login
Qt Code:
  1. //frmLogin declaration
  2. class frmLogin : public QDialog
  3.  
  4. //frmLogin constructor
  5. frmLogin::frmLogin(QWidget *parent) :
  6. QDialog(parent),
  7. ui(new Ui::frmLogin)
  8. //button clicked slot that closes frmLogin
  9. void frmLogin::on_btn_Close_clicked(){
  10. this->close();
  11. this->changedUser = false;//user not changed
  12. }
To copy to clipboard, switch view to plain text mode 
the dialog is created when the user clicks the login button on its parent component, frmWeapon
Qt Code:
  1. //frmWeapon declaration
  2. class frmWeapon : public QDialog
  3. //frmWeapon constructor
  4. frmWeapon::frmWeapon(QWidget *parent, QString user, int uID)
  5. : QDialog(parent), ui(new Ui::frmWeapon), curUser(user), userID(uID)
  6.  
  7. //button clicked slot that shows frmLogin
  8. void frmWeapon::on_btn_Login_clicked(){
  9. frmLogin l(this);
  10. //hide frmWeapon object for appearance reasons
  11. this->setVisible(false);
  12. //show frmLogin
  13. l.exec();
  14.  
  15. if(l.userChanged()){//login sucessful user changed
  16. this->userID = l.userID();
  17. this->curUser = l.user();
  18. this->setWindowTitle("Weapon Workbench - "+ curUser );
  19.  
  20. //load new users weapon and projectile data
  21.  
  22. //frist remove all old configs
  23.  
  24. do{//remove old weapons
  25. ui->cbo_Weapon->removeItem(1);
  26. }while(ui->cbo_Weapon->count() != 1);
  27. do{//remove old projectiles
  28. ui->cbo_Proj->removeItem(1);
  29. }while(ui->cbo_Proj->count() != 1);
  30.  
  31. //now add new configs
  32. this->populateWpnConfig();
  33. this->populateProjConfig();
  34.  
  35. }
  36. //reshow frmWeapon
  37. this->setVisible(true);
  38.  
  39. }
To copy to clipboard, switch view to plain text mode 
currently when i click on the close button for frmLogin it closes its parent frmWeapon, and returns control to frmWeapon s parent which is frmHangar,closing frmWeapon which i dont want to happne, frmHangar is also a QDialog and it is created by my main fucntion. any thoughts?

also in an unreleated question, i was looking at the code for the above dialogs which was generated by QDesigner, and i noticed in the setupUi() function, all the widgets for the form were created with "new", but i found no corresponding "delete", so should i add the "delete" for each componet to prevent memory leaks or should i just leave it as is?