I've trying to understand how to make a cmd button call a method when the
button is pressed.

I havne't been seen an example in the Signals & Slots section of the QT docs
which  describe how to connect a widget signal to a callback function, only
how to call a widget slot function.
I don't get any runtime errors in my attempt to do this, but the callback
function isn't being called.

What is the preferred method of registering a non-widget slot to be called
by a widget signal?


class Dialog(QtGui.QDialog):

   def __init__(self, parent=None):
       QtGui.QDialog.__init__(self, parent)
       self.patchBrowser = QtGui.QTextEdit()
       # layout code omitted for brevity

   def updateTextBox(self): # this function shoul dbe called, when the
button is pressed
       self.patchBrowser.setPlainText(self.tr("Callback was called"))

   def createPatchnameComboBox(self):
       self.patchNames = QtGui.QComboBox()
       self.patchNames.addItem("Entry 1")
       self.patchNames.addItem("Entry 2")

       # layout code omitted for brevity

       #self.connect(self.patchNames, QtCore.SIGNAL("higlighted"), self,
QtCore.SLOT("updateTextBox") ) # doesn't call updateTextBox
       self.connect(self.patchNames, QtCore.SIGNAL("activated"), self,
QtCore.SLOT("updateTextBox") )
_______________________________________________
PyKDE mailing list    [email protected]
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde

Reply via email to