[Qt-interest] Alignment in QTableView

Andre Somers andre at familiesomers.nl
Wed May 26 21:14:55 CEST 2010


Op 26-5-2010 18:21, Andre Somers schreef:
>
> It would be nice if you could easily create some light-weight layout
> rules, perhaps in a CSS like way. The presentation of items is of course
> always based on their state. That state can be in the main model like in
> the case of the checked state we have now, but perhaps it should also be
> easier to attach user-defined states to an existing model without
> actually changing that model. Currently, there is only one such a state
> like this that lives outside the model itself, and that is the selection
> as presented in the selection model. If you could attach your own such
> state-carrying models to your data models and optionally share them
> across views, you would end up with a very flexible system. If you
> combine that with an easy to use CSS-like way to define how states
> influence presentation, where states can act as CSS selectors or
> pseudo-states, I think you have a real winner.
>
> Perhaps all of the above is already possible based on the current base
> or could be added to Qt in a binairy compatible way. It is worth
> thinking about in any case...
>    
The more I think about it, the more I think it is doable to build this. 
Sounds like a very interesting little side project...

/me is thinking out loud now
If you connect the additional, state-carrying model(s) to the 
delegate(s), just like the selection model is attached to the view(s), 
there is no need to change the current QAbstractItemModel or 
QAbstractItemView to support this. The main issue I think at this 
moment, is how to actually render the content based on such a style 
sheet, and how to translate the data in the "state-models" to 
pseudo-states that can be used by such a renderer. Still, that sounds 
solvable...


André





More information about the Qt-interest-old mailing list