PDA

View Full Version : Passing event to parent



QPissedOff
26th April 2006, 17:23
Hi all,
I have a widget (OpArea) that reimplements QWidget's wheelEvent handler. The parent of this widget is a scrollArea. I need the wheelEvent of OpArea to be called and under certain circumstances (no Alt modifier) the event needs to be propagated to the parent, to scroll the window.


void OpArea::wheelEvent(QWheelEvent *event)
{
if(event->modifiers() == Qt::AltModifier)
{
//handle the event in OpArea
static int theta = 0;
if (event->delta()>=0)
{
theta= theta +20;
}
else
theta = theta -20;

if (theta <0)
theta = 340;
if (theta> 340)
theta = 0;
cout << theta <<endl;
}
else
{
//send to parent's wheelEvent...
}

}

I think i should be using QApplication::notify() or maybe postEvent() but I am not sure exactly how.... I would appreciate any ideas, thanks

QPissedOff
26th April 2006, 17:37
nevermind, I used event->ignore() to send the event up the chain to the parent.
thanks anyway..