Question

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 -

Was it helpful?

Solution 2

If you are trying to do it using QWSServer::clientWindows (), then forget about it. QWSWindow and QWSClient are just providing interfaces to get information about client windows. You can not control them from the server application.

There are two ways to do what you want :

  • do it from the application creating the window
  • embed the client windows using QWSEmbedWidget, and then you get some kind of control

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top