Hi there,
I'm implementing a login/logout mechanism and I have a really strange problem.
I have created a main window with a constructor of this type:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui_(new Ui::MainWindow)
{
// call a login dialog
// the login emits a signal with the login status
// if ok start the application and create all the interface (calling a function that does the ui_->setupUi(this); )
}
when the user wants to log out he goes on the logout button.
A function that cleans everything (for the menu I use menubar()->clean() ) is called and then the login dialog is created again.
If the user now logs, the same function that does the ui_->setupUi(this); is called but the menu actions now are not connected
If instead of using the designer I create the menu and the actions manually, everything works.
I have discovered that the problem is due to a "double call" to ui_->setupUi(this);
I have also tried to put a flag and try to not to call it if the user logs in the second time, but if I don't call that function the interface will not be showed.
I would need a function to disconnect all the actions of the menu (like a ui_->undoSetupUi(this) )
Any hints?
Cheers!
Bookmarks