Well, then that's easy. You don't want A to get C's events before C gets it, you want A to get them instead of C. The simplest way is to add a flag to B and C that they should ignore input events and in appropriate event handlers (mouse{Press,Move,Release}Event, key{Press,Release}Event) call QEvent::ignore() on the event object you get. Then events from C will be propagated to the parent (B) which will ignore them again and they'll reach A where you can handle them in the regular event handlers.
class C : public ... {
public:
void setIgnoreInputEvents(bool v) { m_ignoreInput = v; }
protected:
if(m_ignoreInput) { ev->ignore(); return; }
// do your regular stuff here
}
private:
bool m_ignoreInput;
};
class C : public ... {
public:
void setIgnoreInputEvents(bool v) { m_ignoreInput = v; }
protected:
void mousePressEvent(QMouseEvent *ev) {
if(m_ignoreInput) { ev->ignore(); return; }
// do your regular stuff here
}
private:
bool m_ignoreInput;
};
To copy to clipboard, switch view to plain text mode
Bookmarks