QTabBar: padding size inside tabs
-
Hi,
I have already created the same topic on qtcentre, but I never get answer there, so I am copying it there.Is it possible to get padding size inside of QTabBar's tab according to current style?
I have an application running on Gnome, KDE, Windows. I use QTabWidget + QTabBar to show tabbed pages and I need to show close button + text + icon on some tabs and only icon on other tabs.
So I need to set some fixed width to those icon only tabs. I'd like to achieve centering icon in tab on all platforms.
The problem is, that every style has different left padding inside tab (look at attachement, black line = padding I want to know).
Is there any way to get this padding? Something like QStyle:: pixelMetric()?If I know this size, it will be then very easy to calculate desired width for tab.
Thanks for any help.
!http://dl.dropbox.com/u/42835431/tabbar-margin-width.png(Tab margins)!
As you can see from screenshot, this padding is very very small in KDE and quite significant in Gnome.
-
Hi,
maybe you can take a look at stylesheets!
"stylesheet-reference":http://doc.qt.nokia.com/stable/stylesheet-reference.html
"customizing-qtabwidget-and-qtabbar":http://doc.qt.nokia.com/stable/stylesheet-examples.html#customizing-qtabwidget-and-qtabbar -
Hi,
unfortunately, this is not what I am looking for.
If you use this code:@
QTabBar::tab
{
padding: 0px;
}
@tabs will stop using application style.
-
Have a look at this "code snippet":https://developer.qt.nokia.com/wiki/CustomTabBar in the wiki.
-
It would only help if the left button (QLabel in this case) was placed in the top left corner of tab (0,0).
But this is not the case in Gnome (padding from screenshot), so when I set fixedWidth of QLabel to 35 and tabSizeHint width to 35 too, QLabel just don't fit in tab.