Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bring window to front -> raise(),show(),activateWindow() don’t work

In my Qt-application I open a URL in the default-browser. Afterwards I want to bring the main-window of my application to the front again.

I tried all approaches I could find but none worked. All it does is blink in the taskbar (of Window 7) Here’s an example:

this->viewer->show(); this->viewer->raise(); this->viewer->activateWindow(); 

*viewer is a pointer to a QmlApplicationViewer which is derived from QDeclarativeView

like image 910
Hedge Avatar asked May 22 '11 12:05

Hedge


1 Answers

try this:

viewer.setWindowState( (windowState() & ~Qt::WindowMinimized) | Qt::WindowActive); viewer.raise();  // for MacOS viewer.activateWindow(); // for Windows 

it work in my project ( in my project viewer is QMainWindow): https://github.com/iptton/Rythem .

like image 134
iptton Avatar answered Sep 19 '22 18:09

iptton