Hi.
I am trying to implement QTCore.QSignalM apper using PyQT. I finally got
to a point where I don't receive any compile or runtime error messages,
but I also do not see the final slot function fire off. Here is a
snippet of the code:
self.signalMapp er = QtCore.QSignalM apper(window)
# Use qsignalmapper to use of one slot function for multiple
# widgets. The map() function sends the slot an extra param
# that identifies the sender.
for idx in range(1, maxIngredients+ 1):
wName = 'chkProductIngr edientsDelete_' +str(idx)
w = self.__dict__[wName]
self.app.connec t(w, QtCore.SIGNAL(" stateChanged(in t)"),
self.signalMapp er,
QtCore.SLOT("se lf.signalMapper .map"))
self.signalMapp er.setMapping(w , idx)
self.app.connec t(self.signalMa pper, QtCore.SIGNAL(
"self.signalMap per.mapped(int) "),
self.deleteProd uctIngredient)
def deleteProductIn gredient(self, state, widgetIdx):
"""Delete a product ingredient."""
print "INSIDE FUNCTION\n"
The idea here is to iterate through several checkbox widgets (named
"chkProductIngr edientsDelete_1 , _2, etc.) and connect each object's
"stateChang ed" signal to the mapper's map() function, then connect the
map() function to the actual slot, deleteProductIn gredient().
By the way, I've checked to ensure the statements inside the loop are
being executed.
I am trying to implement QTCore.QSignalM apper using PyQT. I finally got
to a point where I don't receive any compile or runtime error messages,
but I also do not see the final slot function fire off. Here is a
snippet of the code:
self.signalMapp er = QtCore.QSignalM apper(window)
# Use qsignalmapper to use of one slot function for multiple
# widgets. The map() function sends the slot an extra param
# that identifies the sender.
for idx in range(1, maxIngredients+ 1):
wName = 'chkProductIngr edientsDelete_' +str(idx)
w = self.__dict__[wName]
self.app.connec t(w, QtCore.SIGNAL(" stateChanged(in t)"),
self.signalMapp er,
QtCore.SLOT("se lf.signalMapper .map"))
self.signalMapp er.setMapping(w , idx)
self.app.connec t(self.signalMa pper, QtCore.SIGNAL(
"self.signalMap per.mapped(int) "),
self.deleteProd uctIngredient)
def deleteProductIn gredient(self, state, widgetIdx):
"""Delete a product ingredient."""
print "INSIDE FUNCTION\n"
The idea here is to iterate through several checkbox widgets (named
"chkProductIngr edientsDelete_1 , _2, etc.) and connect each object's
"stateChang ed" signal to the mapper's map() function, then connect the
map() function to the actual slot, deleteProductIn gredient().
By the way, I've checked to ensure the statements inside the loop are
being executed.
Comment