Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. QApplication::activeWindow() working incorrectly
Forum Update on Monday, May 27th 2025

QApplication::activeWindow() working incorrectly

Scheduled Pinned Locked Moved Solved Qt 6
8 Posts 3 Posters 1.0k Views
  • 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.
  • I Offline
    I Offline
    iddqd 0
    wrote on 19 Apr 2021, 11:23 last edited by
    #1

    Hello everyone!

    QMessageBox::information(QApplication::activeWindow(),"Error",
                        query.lastError().text(),QMessageBox::Ok);
    

    When I use this construct, the QMESSAGEBOX returns an empty one with no message. The message is sent from another class that does not have widgets.

    J 1 Reply Last reply 19 Apr 2021, 11:34
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 19 Apr 2021, 11:33 last edited by
      #2

      @iddqd-0 said in QApplication::activeWindow() working incorrectly:

      QMESSAGEBOX returns an empty one with no message

      What does this mean?

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      I 1 Reply Last reply 19 Apr 2021, 11:54
      0
      • I iddqd 0
        19 Apr 2021, 11:23

        Hello everyone!

        QMessageBox::information(QApplication::activeWindow(),"Error",
                            query.lastError().text(),QMessageBox::Ok);
        

        When I use this construct, the QMESSAGEBOX returns an empty one with no message. The message is sent from another class that does not have widgets.

        J Offline
        J Offline
        jsulm
        Lifetime Qt Champion
        wrote on 19 Apr 2021, 11:34 last edited by
        #3

        @iddqd-0 What happens if you don't set parent? Setting parent or not should not have any influence on the content of the message box. What does query.lastError().text() return?

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

        1 Reply Last reply
        0
        • C Christian Ehrlicher
          19 Apr 2021, 11:33

          @iddqd-0 said in QApplication::activeWindow() working incorrectly:

          QMESSAGEBOX returns an empty one with no message

          What does this mean?

          I Offline
          I Offline
          iddqd 0
          wrote on 19 Apr 2021, 11:54 last edited by
          #4

          @Christian-Ehrlicher ук.PNG
          instead of a window with an error message, I get just an empty window

          1 Reply Last reply
          0
          • C Offline
            C Offline
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 19 Apr 2021, 11:55 last edited by
            #5

            What Qt version do you use? Is this called from the main thread?

            Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
            Visit the Qt Academy at https://academy.qt.io/catalog

            I 1 Reply Last reply 19 Apr 2021, 12:04
            0
            • C Christian Ehrlicher
              19 Apr 2021, 11:55

              What Qt version do you use? Is this called from the main thread?

              I Offline
              I Offline
              iddqd 0
              wrote on 19 Apr 2021, 12:04 last edited by
              #6

              @Christian-Ehrlicher I'm using version 6.0.2. Yes, in main thread

              1 Reply Last reply
              0
              • C Offline
                C Offline
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 19 Apr 2021, 12:06 last edited by
                #7

                Ok, fine. Can you create a minimal example to reproduce the problem? It looks like a QMessageBox in main() should also trigger your issue.

                Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                Visit the Qt Academy at https://academy.qt.io/catalog

                I 1 Reply Last reply 22 Apr 2021, 09:43
                0
                • C Christian Ehrlicher
                  19 Apr 2021, 12:06

                  Ok, fine. Can you create a minimal example to reproduce the problem? It looks like a QMessageBox in main() should also trigger your issue.

                  I Offline
                  I Offline
                  iddqd 0
                  wrote on 22 Apr 2021, 09:43 last edited by
                  #8

                  @Christian-Ehrlicher

                  thanks for the help. Your tips helped solve the problem!

                  1 Reply Last reply
                  0

                  1/8

                  19 Apr 2021, 11:23

                  • Login

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