[Qt5-feedback] Item Views Next Gen
Jens Bache-WIig
jens.bache-wiig at nokia.com
Thu May 19 13:57:03 CEST 2011
Hi Steve.
Since I wrote the thing, I should probably join in on this discussion. I
had some basic design goals when I made TableView.
1) That it could be used to implement your typical desktop music
library.
2) That it provided a native look and feel.
3) That it was written within the limits of Qt Quick 4.7 and would work
well with the existing QML item models
I did most of it over easter so it is by no means the complete solution
to every single use case conceivable for existing item views but it
covers a lot of ground already:
- Native look and feel (with mac-specific improvements of Qt item views)
- Reordering of header sections
- Support for sort column indicators (but no automatic model sorting)
- Resizing of header sections
- Automatic resize to (visible) content
- Support for elide modes per column
- Delegates to dynamically change styling of headers, rows and
individual items as well as embedding components (widgets)
(for a screenshot, you can refer to this: http://i.imgur.com/8o1qp.png)
With respect to models. My main goal was to make it work natively with
the built in QML models. This means ListModel, XMListModel etc. These
models are one-dimentional in nature and simply provide a set of basic
properties per model index. As you mentioned, my proposed solution is
based on providing one model property to feed each item per row. You
should be able to work around this limitation by making the column
property itself a property-value map. As for other C++ models, you may
need to write a proxymodel so that the property names are exposed to QML
in the same way. (For instance the QMLViewer does this to expose a
QDirModel to it's internal directory browser)
My main concern right now is to get improved performance out of
ListView. TreeView is not something I have looked into yet and I am not
sure how to structure the models to support it. My main goal was not to
implement everything Qt Item View does but to support the most common
use cases for the desktop.
As for multiple selection, I know we will have to support it, but I
simply haven't gotten around to investigate it yet. It might require
some improvements in the ListView itself but it is on our to-do list for
sure. What you see in the repository is what we have right now.
If you want to contribute or suggest other improvements, they are
certainly welcome.
Regards,
Jens Bache-Wiig
> I've just had a quick read of the code.
>
> It seems like it only works with QML ListModel type models at the moment,
> but not QAIM. ( root.model.get(rowIndex) won't work for a QAIM).
>
> It seems like there's only one role of data possible per column, and it must
> be specified in a TableColumn element in the header property.
>
> Does the research include plans to make it possible to use QAIM with these
> QML views, or is that considered a dead end? Does it include work to make it
> possible to make multiple roles of data available? Does it include work to
> get features from the QTableView like re-ordering columns, resizing columns,
> selecting multiple rows/items (QML has no concept of a selection model) etc?
> Does it include making new features possible like sticky columns that don't
> move when I scroll horizontally, or zooming out and in?
>
> I'm not trying to be annoying, just trying to understand the scope of what
> you're trying to do with this stuff. Tables, trees and model-view separation
> are difficult. You might have hard work and spaghetti code ahead if you want
> to make them all available in QML.
>
More information about the Qt5-feedback
mailing list