[Qt-interest] Maintaining stylesheet defs in custom delegate

Andre Somers andre at familiesomers.nl
Sun Aug 15 14:47:24 CEST 2010


  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.
>
> >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.

André


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100815/4646db0e/attachment.html 


More information about the Qt-interest-old mailing list