[bt-devel] tree keys and Qt4 Model/View architecture

Eeli Kaikkonen eekaikko at mail.student.oulu.fi
Thu Jun 7 03:28:09 MST 2007


On Thu, 7 Jun 2007, Martin Gruner wrote:
> I believe that one reason for the first test program's problems with tree
> display is
>
> inline int columnCount(const QModelIndex &parent = QModelIndex()) const
> {return 1;}
>
> It means that the Tree has only one level. Sub-Items have column+1 of their
> parent items, IIRC.

I don't think so. The whole view has columns which each can have
different data. Like a directory wiew can have the tree in the leftmost
column and each item has name in that column and other properties in
other columns. Actually in my test program I have stored the path-like
key in the second column and user readable header in the first. Only the
first column is shown in the view.

Maybe the model as a whole is the reason. After all it's meant for
dynamic data. More static data could use some optimization. Anyways, the
QTreeWidget feels more responsive after you have opened some tree first
time.

My latest test version has tooltips (one line of code) and
open-item-when-selected (also one line of code) so it's quite complete.
But I still have some difficulties understanding the original widget.

Why there is a list of modules and not one module?

  Yours,
	Eeli Kaikkonen (Mr.), Oulu, Finland
	e-mail: eekaikko at mailx.studentx.oulux.fix (with no x)



More information about the bt-devel mailing list