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.
  • J jsulm
    16 Oct 2018, 04:18

    @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 Offline
    J Offline
    J.Hilk
    Moderators
    wrote on 16 Oct 2018, 04:39 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.

    J 1 Reply Last reply 16 Oct 2018, 04:40
    0
    • J J.Hilk
      16 Oct 2018, 04:39

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

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 16 Oct 2018, 04:40 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
      • J jsulm
        16 Oct 2018, 04:18

        @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 16 Oct 2018, 11:02 last edited by Mask
        #13

        @jsulm
        What is "logedOn ()"?

        J 1 Reply Last reply 17 Oct 2018, 04:12
        0
        • M Offline
          M Offline
          Mask
          wrote on 16 Oct 2018, 18:41 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
            16 Oct 2018, 11:02

            @jsulm
            What is "logedOn ()"?

            J Offline
            J Offline
            jsulm
            Lifetime Qt Champion
            wrote on 17 Oct 2018, 04:12 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 17 Oct 2018, 05:48
            0
            • J jsulm
              17 Oct 2018, 04:12

              @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 17 Oct 2018, 05:48 last edited by
              #16

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

              J 1 Reply Last reply 17 Oct 2018, 05:57
              0
              • M Mask
                17 Oct 2018, 05:48

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

                J Offline
                J Offline
                jsulm
                Lifetime Qt Champion
                wrote on 17 Oct 2018, 05:57 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 17 Oct 2018, 12:41
                1
                • J jsulm
                  17 Oct 2018, 05:57

                  @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 17 Oct 2018, 12:41 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?

                  J 1 Reply Last reply 17 Oct 2018, 12:43
                  0
                  • M Mask
                    17 Oct 2018, 12:41

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

                    J Offline
                    J Offline
                    jsulm
                    Lifetime Qt Champion
                    wrote on 17 Oct 2018, 12:43 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 18 Oct 2018, 13:53
                    1
                    • J jsulm
                      17 Oct 2018, 12:43

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

                      M Offline
                      M Offline
                      Mask
                      wrote on 18 Oct 2018, 13:53 last edited by
                      #20

                      @jsulm
                      Ah okay, thank you!

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        Mask
                        wrote on 19 Oct 2018, 10:27 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?

                        J 1 Reply Last reply 19 Oct 2018, 10:33
                        0
                        • M Mask
                          19 Oct 2018, 10:27

                          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?

                          J Offline
                          J Offline
                          jsulm
                          Lifetime Qt Champion
                          wrote on 19 Oct 2018, 10:33 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

                          20/22

                          18 Oct 2018, 13:53

                          • Login

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