WA_TransparentForMouseEvents for parent but not for children

  • I have a QWidget parent, which contains QWidget composed as its child. composed contains two widgets: QWidget childA(& composed), childB(& composed). Now I want all the mouse clicks on childB to be transmitted transparently to the parent. If I set @composed.setAttribute( Qt::WA_TransparentForMouseEvents)@
    it works, but childA also does not react on mouse events than. Is there any way for composed to be transparent so that childA is still responding to mouse events? I tried reimplementing event() for composed
    @ bool ComposedWidget::event( QEvent *event )
    childB.setAttribute( Qt::WA_TransparentForMouseEvents);
    if (event->type() == QEvent::MouseButtonPress ||
    event->type() == QEvent::MouseButtonRelease) {
    return false;
    return QWidget::event(event);
    but it does not work. Clicks on childB do not reach parent as they did when I set @composed.setAttribute( Qt::WA_TransparentForMouseEvents)@

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.