[Interest] Custom QAbstractItemView (or similar) to display specific QModelIndex
Pierre-Étienne Messier
pierre.etienne.messier at gmail.com
Wed Oct 10 18:15:31 CEST 2012
I did a custom proxy model based on the following links, seems to work!
- http://www.fioniasoftware.dk/blog/?p=51
- http://lynxline.com/jongling-qt-models/
- http://qt-project.org/wiki/Proxy_model_example_code
Enjoy!
P-É
On Fri, Oct 5, 2012 at 11:49 AM, Pierre-Étienne Messier <
pierre.etienne.messier at gmail.com> wrote:
> 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/20121010/4110d6d3/attachment.html>
More information about the Interest
mailing list