Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-123788

Main widget window lowered

    XMLWordPrintable

Details

    • macOS

    Description

      The main widget window appears lowered on macOS in Qt versions upper than 6.5.1

      This problem afflicts Qt versions 6.6.x.

      Note, this problem occurs opening the program from his Program.app bundle, it doesn't occurs when open from command line or an IDE.

      Simple application test:

      #include <QApplication>
      #include <QWidget>
      #include <QWindow>
      
      #if 0
      #define WORKAROUND
      #endif
      
      int main(int argc, char *argv[])
      {
          QApplication *app = new QApplication(argc, argv);
          QWidget *wid = new QWidget();
          wid->setWindowTitle("Test");
      
      #ifdef Q_OS_MAC
      #ifndef WORKAROUND
          wid->activateWindow(); // fails
      
          wid->show();
      
          wid->activateWindow(); // fails
          wid->windowHandle()->requestActivate(); // fails
          wid->raise(); // fails
      
          // wid->lower(); // fails
      #endif
      
      /* QWidgetWindow raised and focused */
      #ifdef WORKAROUND
          QApplication::connect(app, &QApplication::applicationStateChanged, [=](Qt::ApplicationState state) {
              if (state == Qt::ApplicationActive)
              {
                  wid->show();
              }
          });
      #endif
      
      #else
          wid->show();
      #endif
      
          return app->exec();
      } 

      I tried to workaround putting QWidget::show after QApplication::applicationStateChanged trigger, but I don't know if it is safe and triggered always, it is tricky.

      👋

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            ctlcltd Leonardo Laureti
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes