[Qt-interest] QTabWidget Style sheet issue
Karol Krizka
kkrizka at gmail.com
Tue Jul 14 12:57:51 CEST 2009
On Tue, 2009-07-14 at 16:07 +0530, Santhosh Y wrote:
> Hi,
>
> In one of the tabs of QTabWidget, I added a widget.
>
> When I do the following, the complete widget's font is shown in bold.
>
> QTabWidget* tw = new QTabWidget ();
> tw->setStyleSheet ("font: bold 14px;");
> tw->addTab (myWidget , "NxDAT"); /// class myWidget : public QWidget {}
>
I know what the problem is, but I'm not 100% sure how to fix it. The
problem is that when you set the following stylesheet:
font: bold 14px;
It will set the style to the widget and all subchildren of it, because
you did not specify to what it applies to. You need to turn it into
something like:
QTabWidget
{
font: bold 14px;
}
That specifies that only widgets that are or inherit from QTabWidget get
the style. Of course, I'm not sure how QTabWidget works and if there is
a specific syntax to only bold the tab text or something.
You can read more about it here:
http://doc.qtsoftware.com/4.5/stylesheet-syntax.html
>
> How to avoid showing bold font to the children of QTabWidget in this
> case the added Widget.
>
> Please help me somebody.
> In the assistant it is told that, children's wont get the parent
> characteristics ???
>
Can you point to the documentation page where did you read that? I think
it might only apply to hard-coded properties, and not stylesheets.
--
Cheers,
Karol Krizka
http://www.krizka.net
More information about the Qt-interest-old
mailing list