[Qt-jambi-interest] QTreeModel with several columns

Robert Lebel boblebel2 at gmail.com
Tue Dec 22 16:22:37 CET 2009


Hi,

I did it by implementing QAbstractTableModel (and did not find it that
easy). I can send you the complete source of my model if you need it.

public Object data(QModelIndex index, int role) {

  ...
  switch (role) {
    case ItemDataRole.DisplayRole:
       switch (index.column()) {
       case 0:
         return "text column 1"
       case 1:
         return "text column 2"



2009/12/22 Helge Fredriksen <hf at poseidon.no>

> Hello!
>
> Anyone have any experience with implementing a QTreeModel with several
> columns? It seems possible to override the columnCount(QModelIndex)
> method to return 2, but I can't seem to find a way to control the text
> shown in column nr. 2 which I really would like to. It seems to
> replicate the text in both columns pr. default.
>
> Do I need to implement the QAbstractTableModel to do this, or can I use
> the QTreeModel in some way?
>
> Helge
> _______________________________________________
> Qt-jambi-interest mailing list
> Qt-jambi-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-jambi-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt.nokia.com/pipermail/qt-jambi-interest/attachments/20091222/351a09aa/attachment.html 


More information about the Qt-jambi-interest mailing list