Question

I have created a program that runs alongside an application in fullscreen. I would like the QMessageBox from my program to be displayed on top of the application that runs in fullscreen.

The platform is Windows 7 and i am using Qt.

I have tried:

QMessageBox *msgBox = new QMessageBox;
msgBox->setParent(0);
msgBox->setWindowTitle(title);
msgBox->setText(text);
msgBox->setWindowFlags(Qt::WindowStaysOnTopHint);
msgBox->show();

With no luck. Any hints?

Était-ce utile?

La solution

Try msgBox->raise(); will notify the user in taskbar, using setWindowFlags(Qt::WindowStaysOnTopHint); you eventually could make it stay on top (evtl. minimize/restore). But a windowmanager, not depending on os, by design should not allow any application to just "steal" the focus from another application, therefor the user still needs to activate (click) your window for gaining focus.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top