Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
None
-
6.6.0, 6.6.1, 6.6.2
-
None
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.
👋