Extending QTabWidget
-
Hi!
I’d like to tweak my tab widget a bit.
My goals are to add pin option to QTabWidget tab, like Visual Studio has for example and the other one is to show line edit inside QTabWidget tab to rename it when it’s double clicked. I couldn’t find anything useful in documentation.
Additionally I’d like to float tabs left and right.Thanks in advance!
Regards,
Jake -
Hi,
You could take a look at "QTabBar":http://qt-project.org/doc/qt-4.8/qtabbar.html for a starting point
-
What do you mean by "some float right and some float left" ?
-
Like in Visual Studio for example.
Screenshot bellow. -
this isn't easy to achieve.
You could use 2 QTabBars, but then you would have the problem that every tabbar must have a selected tab. So you won't be able to split them up and visually display only 1 selected tab.
So your only way to go would be to do all the painting yourself. So you will need to study the Qt source code of QTabBar and take over some parts. For painting you will need to initialize the styling options correct, etc.Alternatively you can do some hacking with stylesheets and intercepting events to simulate it with multiple toolbars.
Showing a lineEdit overlay at the correct position on double-click shouldn't be that hard though.