Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt 4.8.4 QWS Server Programmatically Set Focus With Multiple Client Apps

I understand ( How does windowing work in qt embedded? ) that you should run one Application as the QWS Server to provide window management facilities, but that you can run other Apps with graphical interfaces as well in Qt Embedded for Linux.

I want to programmatically switch focus between windows without requiring mouse / keyboard interaction to achieve focus. I've searched the following docs but am not seeing any way to make a different window 'active':

http://qt-project.org/doc/qt-4.8/qwsserver.html
http://qt-project.org/doc/qt-4.8/qapplication.html
http://qt-project.org/doc/qt-4.8/qsessionmanager.html#details
http://qt-project.org/doc/qt-4.8/qwswindow.html

QWSServer has a method:

const QList<QWSWindow *> & QWSServer::clientWindows ()

Which returns a list of QWSWindows, but I don't see how I can make one of those windows the currently active window. How can I do this? Thanks -

like image 380
PhilBot Avatar asked May 23 '26 00:05

PhilBot


1 Answers

The accepted answer is false in some sense. I think solution is to find needed window by clientWindows, then call QWSWindow::setActiveWindow() and then QWSWindow::raise().

QWSWindow provides the undocumented raise() method. See: qwindowsystem_qws.h definition of QWSWindow. You need this type of functionality if you want to make any sort of window manager.

Undocumented can beat impossible in some situations.

It is even more complex and difficult, if you wish to let non-Qt applications have focus, etc.

like image 56
Bikineev Avatar answered May 25 '26 20:05

Bikineev



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!