[Qt-interest] Maintaining stylesheet defs in custom delegate
Neville Dastur
qt at dastur.me.uk
Sun Aug 15 15:18:43 CEST 2010
On 15/08/2010 13:47, Andre Somers wrote:
> Op 15-8-2010 14:10, Neville Dastur schreef:
>>
>>> I am afraid that using stylesheets from your own drawing is close to
>>> impossible at the moment. That is quite a hole in the current
>>> implementation. The current Qt style sheet implementation does not
>>> provide any public API for accessing the relevant data for the object
>>> you're currently drawing. Stylesheets are only supported by the build in
>>> styles, and I'm afraid that also goes for any other custom drawing. At
>>> least, I have not found a way around it yet...
>>>
>> I see. The Qt blg post
>> http://labs.trolltech.com/blogs/2007/11/01/qstyleditemdelegate-styling-item-views/
>> inferred that by using QStyledItemDelegate this issue would be sorted
>> out.
> Hmm... reading that blog (it has been a while), it seems that perhaps
> you are right, and it ought to work.
Do you think this is a bug? I.e. worth reporting.
>>
>> >From your statement, is it a waste of time delving into the Qt
>> library source? Because, presumably Qt must manage it somehow.
> Delving into Qt sources is rarely a waste of time. You may always
> learn something interesting. I know that I found this part of the code
> quite difficult to understand though. Still, the Qt sources may be
> able to show you how Qt itself is drawing that highlight. I think your
> analysis that getting the color from the pallette is wrong is correct.
> The pallette is not affected by the style sheet, I think. AFAIK, it
> acts more as the default in case there is no style sheet, and can even
> be ignored completely by certain styles.
Having a quick look at the stylesheet code it seems stylesheets are
implemented as StyleProxies, which makes me wonder why
style->drawControl() doesn't honour the stylesheets. As you say it's
difficult to follow. I'll try following through the painting of a
standard listview item and see if that sheds any light.
Neville
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100815/1f1c88cf/attachment.html
More information about the Qt-interest-old
mailing list