Retrieve the event position from the event object and then test whether the rect() of the class contains the position of the event, like so:
Qt Code:
if(stackedwidget->rect().contains(pos)){ qDebug("STACK WIDGET HERE"); } }To copy to clipboard, switch view to plain text mode
Note that this will not work if the child widget you want to test against handles the mouse press event itself (like QListView probably does). In that situation you have to reimplement the event in the widget in question or apply an event filter on the child widget to monitor its events. See the docs for reference on event filters.
Bookmarks