[PyQt] How to use Model/View framework
ilochab at gmail.com
Tue May 8 19:51:04 BST 2007
I'm new in Qt programming.
I'm using Model/View framework to develop an editor for tree structures.
It shows tree data on a QTreeView that I link with setModel() to a different
for each set of data read from different files.
My problem is that on the first time that I call setModel() every thing
works fine, but each time I call a new setModel() for a new data-set
(without destroing QTreeView but also without doing new connect() to its
signals), I get a new duplicate calls to all my connected methods.
To be more clear:
I call once
self.widget.connect(self.view, SIGNAL("clicked(const QModelIndex
At the first data-set loaded self.OnItemClicked is called only once
At the second data-set loaded self.OnItemClicked is called twice
and so on.
When I load a new data-set I create a new QAbstractItemModel object with the
new data and I call setModel() again on the old QTreeView object without
What's wrong in this?
Thanks in advance for any answer.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the PyQt