Emit "ALT+TAB" when a pushbutton is clicked.

  • I am trying to control two arduinos from the same computer. For that, I am making two QT gui windows. Now I want to have a pushbutton on both the guis, so that when the button is clicked, "ALT+TAB" signal is emitted and the user can then switch between the two GUI windows. Is this possible?

  • Qt Champions 2017

    You would have to use the platforms native api for this I think.
    Its controlled by the OS.
    You could also make your own solution using
    QLocalServer and QLocalSocket to send "event" to get focus.

  • This post is deleted!

  • Moderators

    It's not possible via the "alt+tab" method, however you wouldn't want to use that anyway. There would be no way to guarantee that you alt+tabbed to the proper window if the sequence was changed by the user via actual alt+tabbing at some point (or even clicking a new window).

    This is however possible using the native windowing system on all platforms. Pretty much exactly as @mrjj said.

    I haven't done it on osx but you can definitely do it with Win32 API and X11. Just google gaining focus of windows in <platform here> with c++ and you should have plenty of articles and reference material to get you through it.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.