PDA

View Full Version : widget focus ---------



jrodway
16th April 2008, 13:19
Hello everybody,

my question is simple (but the answer is usually not simple). I have a widget and i need to know when this widget loose the focus. I need "some mechanism" that warn me when i loose the focus.

thanks in advance!!

Javi.

wysota
16th April 2008, 13:37
The answer is very simple :) QApplication::focusChanged().

jrodway
17th April 2008, 06:14
but i have a problem with this solution, I need to know what's the next widget, but i don't know what's the next widget the user click on...??

how focusChanged is used??

(thanks!!)

wysota
17th April 2008, 06:37
Would you take a look at its documentation and look what parameters it has?

jrodway
17th April 2008, 13:40
question answered, thanks!!

zgulser
15th April 2009, 12:53
how can we use this signal? I mean how can we connect with the specified slot. Because it seems QApplication is not an QObject.

Ginsengelf
15th April 2009, 13:20
Hi, use QCoreApplication::instance() or the static QApplication::qApp to get a pointer for the QApplication object.

Ginsengelf

zgulser
20th April 2009, 08:46
Hi again,

I 've a problem with this method. Once a new frame is poped up, the focusChange signal does not give the focus to this new widget. Therefore I should reimplement focusIn and focusOut events in this new widget. Is there a better way to do this?

Thanks in advance

zgulser
22nd April 2009, 07:21
Can anyone has any idea?

wysota
23rd April 2009, 19:53
What exactly are you trying to achieve? Maybe QWidget::activateWindow() is something for you?

zgulser
27th April 2009, 06:46
Hi again,

I want my widget which grabs the focus by mouse click to be raised.

In my application, the widgets can pop-up upon a button click. Once the particular widget(Widget 1) is popped up, it is raised and may cover some part of the most recently focused widget(Widget 2) (which has just normally lowered in the widget stack).

But when I want to raise it again by clicking on it, it grabs the focus but not raised at all. It couldn't show all of itself ( since the widget 2 covered some part of it.)

I hope I make myself clear.

zgulser
27th April 2009, 09:16
Hi,

Problem solved!

The problem is in the focusing configuration of the widgets. When the ui class has a focus itself, you shouldn't set any focus to it's subwidgets.