Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. WA_TransparentForMouseEvents for parent but not for children

WA_TransparentForMouseEvents for parent but not for children

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Daylight
    wrote on last edited by
    #1

    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) {
    event->ignore();
    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)@

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved