0
votes

I wonder if it's possible to change the cursor of the selected tab of a QTabWidget. I mean : I would like to have an arrow for the selected tab and the "hand" for the others. I was able to set the "hand" for the 4 tabs of the widget, but not individually.

Can I do that?

Thanks

---EDIT--- I have access to the QTabBarof the QTabWidget

1

1 Answers

2
votes

Subclass QTabBar, turn on mouse tracking (setMouseTracking(true)) in it's constructor, in mouseMoveEvent(QMouseEvent* event) call tabAt(const QPoint& position) const and currentIndex() const. If they return the same number use setCursor(Qt::OpenHandCursor), otherwise use unsetCursor() to return to the normal arrow cursor (remember to call the parent class implementation first).

I assume you have access to the QTabBar because you have derived from QTabWidget, otherwise you will have to subclass that to be able to set your new QTabBar derived class.