PDA

View Full Version : i want to lose the focus...



jrodway
8th July 2007, 22:08
Hello everybody.

Excuse my poor english, i´m a spanish qt4 user. my boss order my to do a simple thing, I need, when i click or use the alt-tab key in order to change the active window, that this window never get the focus. i repeat it: i need that 1 window never get the focus, though click on it.

i hope to explain it correctly...

thanks all in advance..

Javier Rodway.

jrodway
9th July 2007, 07:14
plis..... i need a little help.... please...

Eldritch
9th July 2007, 23:54
You should call QWidget::setFocusPolicy(Qt::NoFocus) on the widget when you create it..

jrodway
10th July 2007, 07:15
this doesn't works ok. it must be something related to control the events or similar...

but i can't find the solution....

(thanks anyway...)

please, help me.....

guilugi
10th July 2007, 10:58
Why isn't it ok ?

You want your widget to always stay behing every other window, that's it ?
You should detail a little more what you want to achieve..

A sample would be ideal too :)

jrodway
11th July 2007, 14:12
I've just achieved the window is always at bottom but the ALT+TAB key is pressed.

How can I disable that function (ALT-TAB) for a single window?

thanks!!

Eldritch
11th July 2007, 17:42
I've just achieved the window is always at bottom but the ALT+TAB key is pressed.

How can I disable that function (ALT-TAB) for a single window?

thanks!!

You don't. While I haven't done *exactly* this kind of thing, I've got experience with similar kinds of z-plane manipulation using OS APIs directly (not Qt).

In Windows, what you're wanting to do is manipulate where the window shows up in the Z-plane. Down in the guts of all of this, there is a message called WM_WINODWPOSCHANGING (http://msdn2.microsoft.com/en-us/library/ms632653.aspx). By intercepting that message and modifying its data, you can try to manipulate what's happening, but you're in for a difficult fight with the operating system. The user has indicated, by ALT+TABbing to your window (or, if possible, choosing it from the taskbar), that they want your window to come to the front. You might be able to manipulate the data structure in that message to keep your window behind another window, but you may need some heavy-duty logic to figure out what that window is.

jrodway
14th July 2007, 11:04
i don't know how to continue testing the application.... i don't achieve to control the alt+tab...

maybe under linux was impossible.....