On Tue, 3 May 2011 22:19:27 +0000, Jason Rahm wrote:

> One more thing, how do I pass the value of the clicked item to the
> displayRule def?  Printing test gets the GUI components figured out, but
> not functional.  Thanks in advance.

The itemClicked signal passes two parameters which you can receive in the
method you connect the signal to.

def __init__(self):
  self.treeWidget_iRulesList.itemClicked.connect(self.displayRule)
def displayRule(self, item, column):
  self.textEdit_ScriptCanvas.clear()
  self.textEdit_ScriptCanvas.setText('test ' + item.text() + ' column ' + 
str(column))

> Still not sure about auto-selecting the last item added to the tree.
> Any thoughts would be appreciated.

You could call the tree widget's setCurrentItem() method, passing the last
item. Whether the item will be selected, as well as made the current item,
depends on what the selection mode is. You can change that by calling
setSelectionMode() with the required value:

http://doc.qt.nokia.com/4.6/qabstractitemview.html#SelectionMode-enum

David
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to