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
QtWS25 Last Chance

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

    jsulmJ 1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 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
      0
      • I iddqd 0

        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.

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on 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
        • Christian EhrlicherC Christian Ehrlicher

          @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 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
          • Christian EhrlicherC Online
            Christian EhrlicherC Online
            Christian Ehrlicher
            Lifetime Qt Champion
            wrote on 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
            0
            • Christian EhrlicherC Christian Ehrlicher

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

              I Offline
              I Offline
              iddqd 0
              wrote on last edited by
              #6

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

              1 Reply Last reply
              0
              • Christian EhrlicherC Online
                Christian EhrlicherC Online
                Christian Ehrlicher
                Lifetime Qt Champion
                wrote on 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
                0
                • Christian EhrlicherC Christian Ehrlicher

                  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 last edited by
                  #8

                  @Christian-Ehrlicher

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

                  1 Reply Last reply
                  0

                  • Login

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