I'm using the Qt library to show a slideshow on the second monitor when the user isn't using the second monitor. An example is the user playing a game in the first monitor and showing the slideshow in the second monitor.
The problem is that when I open a new window in Qt, it automatically steals the focus from the previous application. Is there any way to prevent this from happening?
It took me a while to find it but I found it:
This forces the window not to activate. Even with the
If you want to make floating preview box/ any other widget just use below
thumbnail = new QLabel; thumbnail->setAttribute(Qt::WA_ShowWithoutActivating); thumbnail->setParent(0); thumbnail->setWindowFlags(Qt::Tool | Qt::FramelessWindowHint|Qt::WindowStaysOnTopHint);
Qt::Tool is important flag to make it work. I mean not stealing focus.