PDA

View Full Version : Clickable no focus window



manojmka
6th August 2010, 06:23
I am trying to implement a virtual remote control for my embedded arm 9 application. Focus on widgets can be changed using arrow keys on remote control, hence it seems best idea to post key events on qApp->focusWidget() but focus shifts to remote control as soon as I click on it.

(1) I have made virtual remote control Ui with NoFocus policy but no help.
(2) I tried activating the selected window first before posting key events from virtual remote control, but it always puts focus on first widget on that window.

Is there anyway in Qt, I have virtual remote control window such a way that I can click on it, but focus/activation never shifts to it?

aamer4yu
6th August 2010, 06:29
You can try QWidget::setFocusProxy

manojmka
6th August 2010, 07:11
I tried, but no Help.

manojmka
9th August 2010, 06:30
I found a workaround for this by overriding event() for every UI screen in my application and resetting the focus to last focus widget on Activate event. This works, but is not a good design and a kind of hack. This also produces problems in case of controls like combo boxes, I can not select any value in combo box because it closes as soon as the focus is shifted to other window.
The best solution to my prblem seems to have a clickable but no focus window, but I don't know how to do that with Qt. Any pointers are welcome.

sztomi
30th March 2011, 12:27
I know it's an old thread, but for people who come here via google in the future:

To show a widget without stealing input focus from another do this:

widget->setAttribute(Qt::WA_ShowWithoutActivating);

I created a date editor lineedit descendant which created a frameless calendar widget next to it (setWindowFlags(Qt::FramelessWindowHint)). This works nicely.

swdev
5th July 2014, 03:58
I have solution for this, in the case of creating chrome like tab in titlebar. Have a look at this SO page: http://stackoverflow.com/questions/24582525/how-to-show-clickable-qframe-without-loosing-focus-from-main-window?lq=1