[PyKDE] PyQt and trees

Andreas Pakulat apaku at gmx.de
Sun Apr 9 22:50:55 BST 2006


On 09.04.06 23:27:09, Bert Rodiers wrote:
> model based solution. As a result of a certain action the tree has to
> be filled in. At that moment I created the model and changed the model
> to the new model:
> 		model = TreeModel(tree)
> 		self.networkTree.setModel(model)
> If I ran this program, the tree wasn't filled in. However when I
> debugged it it was filled in. It was enough to put a breakpoint in the
> __init__ function of TreeModel to have the tree being filled in. Has
> somebody else also had this problem?

No.

> And what to do about it?

Provide a minimal compilable example that demonstrates your problem. We
can't tell what's going on from the snippet above, at least I can't.

> My second try was with QTreeWidgets, but than also the tree didn't
> refresh (this time even not when I was debugging... ;-) )
> I expected that the tree updates when I insert a widget, for example with:
> 		self.networkTree.insertTopLevelItem(0, treeRoot)

I did not yet do anything with QTreeWidget, but I think you have to
provide all items yourself, so this would only add the top-level-item,
nothing more.

> Another problem which I have specifically with trees is that I don't
> get their signals, for other widgets it works. An example is:
> QtCore.QObject.connect(self.networkTree,
> QtCore.SIGNAL("itemSelectionChanged()"),
> self.newNetworkSelectionCallBack) for QTreeWidgets.

No idea about that one though.

Andreas

-- 
You will gain money by a fattening action.




More information about the PyQt mailing list