Qt World Summit: Submit your Presentation

Determining which sub-Widget the MousePressEvent applies to

  • I have a Composite widget with a number of Frames, Group Boxes.

    When I receive a MousePressEvent I can extract the position using:

    if (Qt::LeftButton == event.buttons())
    		QPoint point(event.pos());

    But how to detect which sub-widget this is in.

    On Windows you do: if (Frame1.PtInRect(pt)) which returns true if the Point pt is in window Frame1.

    What's the equivalent in Qt please? Is it if (Frame1.underMouse()) ? Yes, that does the job! Solved.

Log in to reply