문제

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

도움이 되었습니까?

해결책

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.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top