A proper approach would be to not overuse style sheets.
A proper approach would be to not overuse style sheets.
Can you please elaborate what you mean by "overuse stylesheets" here? There is already working application where stylesheets were used to give the application nice look. I thought it is exactly the way stylesheets are supposed to be used.
Now I have to make a minor change to the application (well I thought it would be minor, but apparently its not): make rows of one of the table views to blink in some special cases.
Do you think the only way now is to get rid of the stylesheets in the entire application?
I mean total restyling of your application only using stylesheets.
You can make them blink. They just won't follow stylesheets anymore. Hence my original answer.Now I have to make a minor change to the application (well I thought it would be minor, but apparently its not): make rows of one of the table views to blink in some special cases.
No, I mean you should style your table with a custom delegate and not stylesheets. You can use stylesheets for other things.Do you think the only way now is to get rid of the stylesheets in the entire application?
Did I get it right that for this particular table I need to disable stylesheets and do the entire drawing in the delegate? What would be the way to disable the stylesheets for a particular QTableView regardless of how complex parent widget's stylesheets are? The stylesheets can be cascading to the table from several parents. Do I have to amend selectors for all of them?No, I mean you should style your table with a custom delegate and not stylesheets. You can use stylesheets for other things.
Last edited by topoden; 21st May 2013 at 15:06.
You don't need to disable stylesheets. Just don't style items or ignore that they do have any style. If you implement your own delegate and not call the base class implementation, items in the table will not be styled by stylesheets.
Got it, but is it possible to somehow work around implementing the entire drawing by myself but calling the base class's method with a hint not to use stylesheets? Say, in debugger I see it takes the style to draw with from QStyleOptionViewItemV3::widget property. Do you think it can be right to amend this property somehow in the sub-classed delegate paint method and then call base class's one?
If you use QItemDelegate instead of QStyledItemDelegate (which is the default) then stylesheets will not be used in items.
topoden (21st May 2013)
Bookmarks