PDA

View Full Version : QTabWidget / QBarWidget



alexandernst
4th August 2010, 20:04
I have a problem with QTabWidget/QTabBar documentMode option.
If I set that option to True this is what happens:

http://imagebin.org/108119
(http://imagebin.org/108119)
As you can see, I can move the tab from the most-left to the most-right side without any problems. But, there are two bad things. First one is that it screwes my qss style, as you can see in this other image. And the second one is that completely ignores my qss subcontrol styling that will make bars appear in the center.

http://imagebin.org/108120

As you can see here, tabs do appear in the center, and my qss is exactly as I want it. But there is a problem. Trying to move the tab to the left or to the right will result in that bug you see in the image (when I tried to move the tab to the left). It gets hidden. If I add tabs, I can move them, and they only dissapear when I try to move them outside of the limits of the rect that holds the tabs.
Any ideas how could I fix that?
Thanks!

alexandernst
4th August 2010, 21:05
After some more hacking, I'm pretty sure that my problem is the qtabbar rect.
How can I force the qtabbar rect to be always (0, 0, tabwidget.width(), 20) ?
I tried subclassing qtabwidget and resizeEvent this way:


def resizeEvent(self, e):
self.tabBar().setGeometry(self.tabBar().x(), self.tabBar().y(), self.width(), 20)

but tabbar rect will do weird things when resizing (in fact, it just wont paint itself. It will repaint itself only after resizing has finished.
Also, tabs won't have the size that I want, but the total size of the rect.

me_ahmadi
1st August 2011, 02:46
Hi,
is there any answer for the last reply, i have the same problem and i want to use tabbar of a qtabwidget in another position.
thanks

alexandernst
15th August 2011, 18:28
I haven't found one, sorry :(