PDA

View Full Version : QTabBar and a QTabWidget-like frame



eelik
16th January 2008, 16:15
Hello.

I'm new here and though I'm not a complete newbie with Qt I thought it would be better to ask this question in this section.

How can I make a widget with a QTabBar which is not QTabWidget but looks like it so that there is a bar integrated seamlessly with a frame which doesn't have the upper border?http://iki.fi/eelik/tabbarugly.png

This one in the picture has a listwidget below the bar but the bar is just floating there. The listwidget should be inside a frame which uses the bar as the top border but doesn't have its own top border.

wysota
16th January 2008, 17:16
I'm not sure I follow what you mean, but maybe setting the spacing of the layout containing the two widgets to zero will do what you want?

eelik
16th January 2008, 18:17
If I do that the frame still has the upper border and it doesn't look like it's "integrated" with the tab bar. See the picture above and think about having a frame instead of the list widget and moving it up - it doesn't look good.

I tried to find a solution by looking at QTabWidget source code but it uses quite complicated QStyle and other things for the internal widget stack drawing. I can't follow it.

My original problem was that I want to use a tab bar for a frame which includes many elements but only one element is really unique for each tab. The other elements remain the same so I don't want to create deep copies of them for each page. The easiest solution was to use a widget stack and tab bar. The tab bar changes the page of the stack, the other elements just remain there.

Other solution was to use the QTabWidget, but it can't have many pages pointing to one widget. I'm I doomed to creating several widgets which have identical items?