View Full Version : Style sheets and font weight bug
Oleg
13th February 2010, 23:27
Hi, all.
I have a strange bug with QTabWidget styling it with custom sheet. So, I have the following code:
QTabBar::tab {
font-weight: bold;
padding: 0px 10px 0 10px;
}
And the font is really bold, but the place for the text doesn't increase, so first and last letters are invisible.
Any suggestions, what have I missed? Thanks in advance.
psih128
14th February 2010, 07:14
Im not much into stylesheets, but is it possible to change the width of the tab using the stylesheet? Something like
min-width: 100;
Although it sounds like a bug
Oleg
14th February 2010, 09:03
Yeah, min-width works, but only if text width is less than its value. It doesn't fit my case.
tdt
14th February 2010, 09:35
no it isn't bug
it is right you write, left righ pads are 0
QTabBar::tab {
font-weight: bold;
padding: 0px 10px 0 10px;
}
try without padding
Oleg
14th February 2010, 09:55
I tried it beforehand with no success :( I think it should recalculate widget size depending on font style changing, but it doesn't.
tdt
14th February 2010, 10:14
see attachment
tested direct in designer
---------------------------
wxp, qt450, VS2008
Oleg
14th February 2010, 11:46
So, here's my screenshots, both with no padding.
Normal font:
http://img707.imageshack.us/img707/9545/normalnopadding.th.png (http://img707.imageshack.us/img707/9545/normalnopadding.png)
Bold font:
http://img444.imageshack.us/img444/6766/boldnopadding.th.png (http://img444.imageshack.us/img444/6766/boldnopadding.png)
QTabWidget::pane {
background-color: #ffffff;
border: 2px solid #56aa04;
border-radius: 10px;
top: -1px;
}
QTabWidget::tab-bar {
left: 15px;
}
QTabBar::tab {
border: none;
color: #56aa04;
height: 25px;
font-weight: bold;
}
QTabBar::tab:selected {
background-color: #ffffff;
border: 2px solid #56aa04;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
border-bottom: 3px solid #ffffff;
}
tdt
14th February 2010, 20:55
I tried this on
QTabWidget::pane {
border: 2px solid green;
border-radius: 5px;
}
QTabBar::tab
{
border-top-left-radius:5px;
font: bold 8pt "MS Shell Dlg 2";
border-top-right-radius:5px;
border-top:2px solid green;
border-left:2px solid green;
border-right:2px solid green;
}
QTabBar::tab:selected
{
color: red;
}
it is working properly only when is in designer tabWidget->font->bold checked or programaticaly tabWidget->font()->setBold(true) called
combination of border and font-weight make this error/bug
Oleg
14th February 2010, 22:19
Thanks it makes the deal. I think this issue can be reported as bug on Qt's bugtracker...
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.