Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. The window in the task bar does not appear
Forum Updated to NodeBB v4.3 + New Features

The window in the task bar does not appear

Scheduled Pinned Locked Moved Unsolved General and Desktop
22 Posts 4 Posters 5.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • jsulmJ jsulm

    @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;
    }
    
    J.HilkJ Offline
    J.HilkJ Offline
    J.Hilk
    Moderators
    wrote on last edited by J.Hilk
    #11

    @jsulm said in The window in the task bar does not appear:
    > MainWindowUI = new MainWindow(this);

    parenting to this shouldn't be possible inside main~~


    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


    Q: What's that?
    A: It's blue light.
    Q: What does it do?
    A: It turns blue.

    jsulmJ 1 Reply Last reply
    0
    • J.HilkJ J.Hilk

      @jsulm said in The window in the task bar does not appear:
      > MainWindowUI = new MainWindow(this);

      parenting to this shouldn't be possible inside main~~

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #12

      @J.Hilk Thanks, corrected! Was a copy/paste :-)

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • jsulmJ jsulm

        @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;
        }
        
        M Offline
        M Offline
        Mask
        wrote on last edited by Mask
        #13

        @jsulm
        What is "logedOn ()"?

        jsulmJ 1 Reply Last reply
        0
        • M Offline
          M Offline
          Mask
          wrote on last edited by
          #14

          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.

          1 Reply Last reply
          0
          • M Mask

            @jsulm
            What is "logedOn ()"?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #15

            @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.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            M 1 Reply Last reply
            0
            • jsulmJ jsulm

              @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.

              M Offline
              M Offline
              Mask
              wrote on last edited by
              #16

              @jsulm
              But the "main.cpp" endlessly repeats an if until it's true?
              Is it okay like I did?

              jsulmJ 1 Reply Last reply
              0
              • M Mask

                @jsulm
                But the "main.cpp" endlessly repeats an if until it's true?
                Is it okay like I did?

                jsulmJ Offline
                jsulmJ Offline
                jsulm
                Lifetime Qt Champion
                wrote on last edited by
                #17

                @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.

                https://forum.qt.io/topic/113070/qt-code-of-conduct

                M 1 Reply Last reply
                1
                • jsulmJ jsulm

                  @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.

                  M Offline
                  M Offline
                  Mask
                  wrote on last edited by
                  #18

                  @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?

                  jsulmJ 1 Reply Last reply
                  0
                  • M Mask

                    @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?

                    jsulmJ Offline
                    jsulmJ Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on last edited by
                    #19

                    @Mask "SecDialogPage->exec()" returns as soon as user closes dialog either by accepting (OK) or rejecting (Cancel).

                    https://forum.qt.io/topic/113070/qt-code-of-conduct

                    M 1 Reply Last reply
                    1
                    • jsulmJ jsulm

                      @Mask "SecDialogPage->exec()" returns as soon as user closes dialog either by accepting (OK) or rejecting (Cancel).

                      M Offline
                      M Offline
                      Mask
                      wrote on last edited by
                      #20

                      @jsulm
                      Ah okay, thank you!

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        Mask
                        wrote on last edited by Mask
                        #21

                        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?

                        jsulmJ 1 Reply Last reply
                        0
                        • M Mask

                          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?

                          jsulmJ Offline
                          jsulmJ Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on last edited by
                          #22

                          @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

                          https://forum.qt.io/topic/113070/qt-code-of-conduct

                          1 Reply Last reply
                          1

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved