Movable tabs with my own QTabBar class
I'm trying to create movable tabs in my QT 4.8 application. I have created my own class of QTabBar so I can set my own style, and in that I call setMovable( true ); directly inside the constructor. But tabs are not movable. What else do I have to implement to make the tabs movable? Do I need to implement any of the events for movable tabs to work? I cannot find any documentation on this.
Hi and welcome to devnet,
How are you using that QTabBar ?
I have created my own class inhering from QTabBar. In that class I overwrite tabSizeHint, paintEvent, mouseMoveEvent, and leaveEvent.
The QTabBar is then attached to my own instantiation of a QTabWidget class. In there, I do
setTabBar( new MyTabBar( this ) );
setMovable( true );
That QTabWidget is then instantiated on my QMainWindow.
Since you overwrote mouseMouveEvent, did you forget to call the base class implementation ?
@SGaist a year has passed after your message but now you helped me very much. Thank you!