[Interest] Custom QAbstractItemView (or similar) to display specific QModelIndex
Pierre-Étienne Messier
pierre.etienne.messier at gmail.com
Fri Oct 5 17:49:02 CEST 2012
Hi,
I am developing a preferences/settings framework using Qt model/view
framework. My data structure is a tree containing various preferences. The
various configuration "pages" are branches nodes, and each configuration
items are leaf nodes.
The first visual representation of this framework is done with a QListView:
I represent each "page" by setting setRootIndex() to the proper node. This
works well. Visual representation is done using a custom delegate (the
result is quite similar to Android's preferences menus).
I also need a lightweight, configurable, item-based representation of the
same data stored in the model (editable as well via another deleate). The
display of this view is done in the main window, and could be implemented
for now as (sort of) a QTableView of 1 row height and each column element
is a preference element.
My concern actually is that I need to display non-adjacent preferences in
that table. Let's say my data model is:
Root
|
+- Config1
| |
| +- A
| +- B
|
+- Config2
|
+- C
+- D
I may want to display in the MainWindow view:
[D][A]
I was wondering what would be the most efficient approach here:
- Custom model for the second view that is based on the same underlying
data model (how the 2 models are informed that the same data has changed
underneath?)
- Custom proxy model to re-arrange elements (?)
- QDataWidgetMapper (?)
- Anything else?
Any help would be appreciated!
Thanks,
Pierre-Étienne Messier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121005/fb5f1406/attachment.html>
More information about the Interest
mailing list