On 08.05.06 21:49:05, Sven Flossmann wrote:
> Hi,
> 
> I'm trying to use signals from QTreeWidget, e.g. the
> itemSelectionChanged(), but I have not found a way that works until now.
> 
> Is there anybody out who has got this to work?

Forgot the example :-( Here it is.

Andreas

-- 
Don't look back, the lemmings are gaining on you.
from PyQt4.QtGui import *
from PyQt4 import QtCore

class mywid(QWidget):
	def __init__(self, parent=None):
		QWidget.__init__(self, parent)
		self.tree=QTreeWidget()
		self.tree.setColumnCount(1)
		self.lay=QVBoxLayout(self)
		self.lay.addWidget(self.tree)
		self.item=QTreeWidgetItem(self.tree)
		self.item.setText(0, "ROOT")
		self.item2=QTreeWidgetItem(self.tree)
		self.item2.setText(0, "ITEM2")
		self.item.addChild(self.item2)
		self.tree.addTopLevelItem(self.item)
		self.connect(self.tree, QtCore.SIGNAL("itemSelectionChanged()"), self.treeSel)
	
	def treeSel(self):
		print "Selection"

import sys
app=QApplication(sys.argv)
w=mywid()
QtCore.QObject.connect(w, QtCore.SIGNAL("close()"), app.quit)
w.show()
app.exec_()
_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to