0

Dears,

I would like to create a list of QWidgets (lets say QDial). No problem till here.

self.motorDial = []
self.velocityEdit = []
for iMotor in xrange(3):
self.motorDial.append(QtGui.QDial())
self.velocityEdit.append(QtGui.QLineEdit())


The problem is to connect each of these Widgets to a function, passing to the function the index of the QDial which emitted the "valueChanged()" signal.
Something like:

for iMotor in xrange(3):
self.connect(self.motorDial[iMotor], QtCore.SIGNAL("valueChanged(int)"), self.setVelocity)

def setVelocity(self, val):
self.velocityEdit[iMotor].setText(str(self.motorDial[iMotor].value()))


How can the setVelocity function know the caller in order to set the correct self.velocityEdit[iMotor]?

For what I know during the connection no other arguments can be passed, but it is quite a pity since it would be nice to pass during each connection the identification index of the QDial.

Does anyone knows how to solve this problem?

Thank you in advance!

3
Contributors
2
Replies
3
Views
8 Years
Discussion Span
Last Post by satyapraveen27
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.