PDA

View Full Version : Hi All, Problem in managing events



siva prasanna
30th October 2009, 12:29
Hello all, I created one widget, say it as parent. I placed many push buttons and Icons on that parent widget. So, all Push buttons and Icons were now children for Parent widget.
Now Problem is : When I click on any push button, that push button receives the mouse event. But I dont want that. I want my Parent Widget to receive the mouse events prior to child widgets. What I have to do??
Please send me the solution.
Thanks in advance :)
If you did not understand I will send again a clear message.
thank you,

siva

Skepsor
2nd November 2009, 15:54
Hello siva, I guess I understand what you want to do, I don't know if I'll be clear enough to explain how I think you could do it.
First of all if you have your own QPushButton class (you did a subclass) you could just reimplement the mousePressEvent() function and do something like a delegate with the event to the parent; may be using
nativeParentWidget() you can obtain the button's parent and then pass it the event you have just recieved.
Another way I can figure out is connecting the clicked() SIGNAL of the button, with some SLOT in your widget (perent) that do the job (in this case the event wouldnt be managed by your parent, you just would be usig signals and slots as its expected).
Well thaths what I got....hope it helps

Good luck!