Qt-interest Archive, September 2007
First tab in a QTabWidget not styled properly
Message 1 in thread
Hello !
I came up with a very preculiar problem in Qt 4.3.1. It seems that if I have a tab widget which contains controls
that have dynamic properties set, and I use a style sheet relying on these dynamic properties to do styling, then
the first tab page of the widget will not get styled properly.
You can download a sample project that presents this problem from the following link: http://www.tpu.fi/~t1akeski/QTTabWidgetSample.zip
The sample project has these files:
- BaseDialog.ui - Defines the UI layout of a dialog, with a Tab Widget, two pages and several controls
- BaseDialog.h - Dialog header file
- BaseDialog.cpp - Dialog compilation unit
- Main.cpp - Main code file
In this project, I create and initialize two style sheet strings, one with dynamic properties, and one without.
There's also a UI file which defines a dialog containing a tab widget. The controls in the tab widget have dynamic
properties set.
If you set the first style sheet (which relies on dynamic properties), then the controls on the first tab page
are not styled, but the controls on the second page are. If you use the other style sheet (which doesn't use
dynamic properties), then everything is styled correctly.
This certainly looks like a bug, but perhaps there's a way around it ?
I cannot use the "non-propertie'd" style sheet because my real application will have controls which
must be styled differently depending on their dynamic properties. If I used the non-propertied version, the style sheet
would propagate to cover controls which it should not, and my application would display incorrectly.
To me, it seems that in the tab widget's code, the dynamic properties are not set for the first tab before it's shown,
thus causing the style sheet to ignore some of the controls.
Best Regards,
Antti Keskinen
--
[ signature omitted ]
Message 2 in thread
Antti Keskinen wrote:
> Hello !
>
> I came up with a very preculiar problem in Qt 4.3.1. It seems that if I
> have a tab widget which contains controls
> that have dynamic properties set, and I use a style sheet relying on
> these dynamic properties to do styling, then
> the first tab page of the widget will not get styled properly.
>
> You can download a sample project that presents this problem from the
> following link: http://www.tpu.fi/~t1akeski/QTTabWidgetSample.zip
>
I am unable to access the code. I get,
Not Found
"The requested object does not exist on this server. The link you followed is
either outdated, inaccurate, or the server has been instructed not to let you
have it."
Girish
--
[ signature omitted ]
Message 3 in thread
Girish Ramakrishnan wrote:
> Antti Keskinen wrote:
>> Hello !
>>
>> I came up with a very preculiar problem in Qt 4.3.1. It seems that if
>> I have a tab widget which contains controls
>> that have dynamic properties set, and I use a style sheet relying on
>> these dynamic properties to do styling, then
>> the first tab page of the widget will not get styled properly.
>>
>> You can download a sample project that presents this problem from the
>> following link: http://www.tpu.fi/~t1akeski/QTTabWidgetSample.zip
>>
>
> I am unable to access the code. I get,
>
> Not Found
>
> "The requested object does not exist on this server. The link you
> followed is either outdated, inaccurate, or the server has been
> instructed not to let you have it."
>
> Girish
Yes, this was my error. I had to update the link to: http://www.tpu.fi/~t1akeski/TabWidgetBugSample.zip
Meanwhile, I found a way to avoid this problem by adding a dummy page to the widget.
The dummy page is removed before the widget is shown for the first time. This corrects the styling errors.
- Antti Keskinen
--
[ signature omitted ]