The window in the task bar does not appear
-
@Mask You shoud change your design: this dialog should not show the main window (in fact it should not know anything about main window). Do it like this:
int main(int argc, char *argv[]) { QApplication a(argc, argv); SecDialog *SecDialogPage = new SecDialog(); SecDialogPage->setWindowFlags (SecDialogPage.windowFlags () & (~Qt::WindowContextHelpButtonHint) ); SecDialogPage->exec(); if (SecDialogPage->logedOn()) { MainWindowUI = new MainWindow(); MainWindowUI->showMaximized(); } SecDialogPage->deleteLater(); int ret = a.exec(); delete MainWindowUI; return ret; }
-
I found a solution:
int main(int argc, char *argv[]) { QApplication a(argc, argv); SecDialog *SecDialogPage = new SecDialog(); SecDialogPage->setWindowFlags(Qt::Window); if(SecDialogPage->exec() == QDialog::Accepted) { MainWindow *MainWindowPage = new MainWindow(); MainWindowPage->showMaximized(); } SecDialogPage->deleteLater(); return a.exec(); }
Thank you all for the help you gave me.
-
@Mask said in The window in the task bar does not appear:
What is "logedOn ()"?
It would be a method in your dialog implemented by you. Returns true when user has successfully logged on, else false.
-
@Mask said in The window in the task bar does not appear:
What is "logedOn ()"?
It would be a method in your dialog implemented by you. Returns true when user has successfully logged on, else false.
-
@Mask said in The window in the task bar does not appear:
But the "main.cpp" endlessly repeats an if until it's true?
No, it does not - I don't see any loop there.
The code you posted works if you only return QDialog::Accepted in case user was logged on successfully and exiting the app if not. -
@Mask said in The window in the task bar does not appear:
But the "main.cpp" endlessly repeats an if until it's true?
No, it does not - I don't see any loop there.
The code you posted works if you only return QDialog::Accepted in case user was logged on successfully and exiting the app if not. -
@jsulm
I know that no loops are set, but I'm wondering when the main executes that one. Does it only run after the accept () is called? -
@Mask "SecDialogPage->exec()" returns as soon as user closes dialog either by accepting (OK) or rejecting (Cancel).
-
Sorry for yet the disorder, but I can't declare a global variable, should be a variable qsqldatabase, I also tried to create another header files but there are unsuccessful.
How can I do?@Mask You don't need a QSqlDatabase instance and even less so a global variable!
Please take a look at the documentation and example there: http://doc.qt.io/qt-5/qsqldatabase.html