PDA

View Full Version : Custom tab widget question



PrimeCP
30th July 2007, 18:07
I would like to add widgets in the same horizontal line as the tab area on a QTabWidget. Qt has the API to add a small widget to the left or right hand side but there are a lot of size limits (only 1 button will fit for example).

So I began mocking up a custom tab widget that mimics the QTabWidget but would allow any number of buttons to be entered in that same area, it works just fine but I can't figure out how to get the border to look like the normal QTabWidget. The border that goes up around the tab, and then down around the entire stacked widget. I posted an image where I added a border to the stack widget (just to show where it is at) and the QTabBar with some buttons.

Any idea how to make the bordering look like the QTabWidget (or is there an easier way to get what I want without a custom tab widget)?
How does the normal QTabWidget integrate the border of the QTabBar with the QStackedWidget to make it look like one seamless widget?

jpn
7th August 2007, 11:00
I suppose QStyle::drawControl(QStyle::CE_TabBarTab) is responsible for drawing it like that. The passed style option contains various bits of information how the tab in question is supposed to be drawn.

elcuco
7th August 2007, 11:17
How about putting all those nice buttons into a single QWidget, and then using that new QWidget as the corner widget of QTabWidget...?