1
votes

I have a custom QTabWidget with a custom QTabBar. I need to determine if a point is in the area next to the QTabBar. (see image)

enter image description here

I have a function that accepts a point representing a mouse cursor position. Using the mapFromGlobal() function and the QTabBar.rect().contains() function I can easily determine if the point is inside the QTabBar or not. I then thought it would be easy to determine if the point was inside the tab content or not in a similar way. However, the "page" is larger than the content widget. So by eliminating the QTabBar and the tab content, I can only determine if the point is inside the area shown below:

enter image description here

How can I determine if the point is next to the QTabBar as shown in the first image? Is there a way that I can access the underlying "page" that contains the tab content?

1
If you want us to help you, you must provide a minimal reproducible exampleeyllanesc
I was looking for a conceptual answer and I just figured one out.Blackwood

1 Answers

1
votes

Right after posting I realized that there was a very simple solution.

After mapping the mouse cursor point from global, determine if the QPoint.y() value is less than QTabBar.height().