문제

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?

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top