Some kind of GridView with groupable items and subheaders???
This is post #3 so far, and I'll probably be posting many more questions (but don't worry, I DO search the forums first (the best I can) to make sure someone else hasn't already asked).
First some background info, I am writing my GUI in Qml (hence why I'm posting this in the 'Qt Quick' thread), and I'm doing everything in a text editor, I'm not using any kind of WYSIWYG or other IDE.
Anyways, what I need help with right now, is I'm trying to find a good way to present data in my app, what I want is like a GridView, but I would like to be able to have the items grouped by alphabet (and maybe have other group options for the user, such as date, etc.), and have "subheaders", so everything that starts with 'A' would be in group 'A' and have a header that says 'A', and right after that would be group 'B' with a header that says 'B', etc., etc. or if the user chose to group by Date, then the first group might be "1998", with a header that says "1998", then group 2 might be "1999" with a header that says "1999", etc., etc.
Since the Grid and GridView components only seem to have a Header and Footer all I can think of is to have each group be it's own grid, is there any other way of doing this??? Would it be best to just make a new component that inherits Grid or GridView? And if so how would I do that?
If my question is confusing in any way please let me know and I'll try to reword it the best I can, and thanks in advance for any help.
Well at this point I'm pretty certain there are no existing components/widgets like this, so what I'm doing (well, 'attempting' would be more accurate) is using a PageStack (might be an Ubuntu specific component, not sure) with a javscript for-loop, and Qt.createQmlObject() creating Pages with GridViews inside the pages. When (if) I get something working I'll post my solution.
Alek Śmierciak last edited by
How about using QtQuick 5 "ListView":http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-listview.html, which supports sections based on the data model and your choice out-of-the-box? The display style is customized by the delegate Component object.
Isn't a ListView and GridView basically the same thing? Except one is in list format and the other is in grid format? Or can a ListView be in a grid layout?
But that does actually give me an idea, I could have a ListView, where each Item contains a Text component and a GridView component, then the ListView's model could contain all the categories, then for the GridView's models I could have an array of models. If an array of models proves too difficult than I can just have a Grid, and deal directly with adding/removing items myself.
The reason is it needs to be able to add and remove grids dynamically, based on changing data.
Alek Śmierciak last edited by
GridView does not seem to handle visual grouping and sections as ListView does. On the other hand, laying items in a grid in a ListView might not be so straight-forward.