Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to get mouse event from QTabBar
GrahamL last edited by
I want track mouse events occurring in the QTabBar widget inside my QTabWidget but dont see how to do this.
I would be grateful if someone could provide some hints
You can look for the QTabBar using findChild and install an eventFilter on it
Hope it helps
ich have near the same problem with the Handlich of QTabBar.
I need do use a mouse-right-click for a special handling by changing the tabs. But I did not find out how to impelent the eventFilter mousePressEvent for that. I can fetch the right click, left clicks, but I am not able to make the same handling by the right click (setting the tab as activ).
So for what should this be done: I want to change the tab by left click and fill in some 'special' data into that QTabWidget.
I want to use the right click in the same way, but I want to fill 'all' (different fillings into lists) data into that QTabWidget.
There are the same elements only different content.
I hope you could understand my text, I am a nuub in programming and english.
Thx for help !!!
do I have to open a new discussion to get an answer, ist this here the wrog place ? please give me a hint.
Please practice some patience, waiting 24 to 72 hours before bumping your question is common. Not everybody on this forum lives in the same timezone as you.
What did you already try ?
I tried a lot and now I am so confused ..
I installed an eventFilter so far so good.
I am able to get 'QT::LeftButton' and 'QT::RightButton' and the event 'QT::MouseButtonPressed'.
Now I want to indentify the clicked Tab by index (if possible) in QTabBar (even left or right mousebutton has been used to click) - this is not possible.
I need the index from the clicked Tab because I want to have the same behavior like we have with the left one. Only some data should be different shown.
I think I will give up, I have no more Ideas.
You can also subclass QTabBar and set it on your QTabWidget, it will be easier to play with the tabs in there.