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. Determining which sub-Widget the MousePressEvent applies to
Qt 6.11 is out! See what's new in the release blog

Determining which sub-Widget the MousePressEvent applies to

Scheduled Pinned Locked Moved Solved General and Desktop
1 Posts 1 Posters 197 Views 1 Watching
  • 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.
  • PerdrixP Offline
    PerdrixP Offline
    Perdrix
    wrote on last edited by Perdrix
    #1

    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.

    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