Hi together,

I've a problem using the QCheckBox.stateChanged Signal within a
QSignalMapper.
The stateChanged Signal is emitted with an integer argument but the
QSignalMappers
map() Slot only accepts a call without an argument ... so I get the
following error.

Error calling slot "map"
TypeError: 'PySide.QtCore.QSignalMapper.map' called with wrong
argument types:
  PySide.QtCore.QSignalMapper.map(int)
Supported signatures:
  PySide.QtCore.QSignalMapper.map()
  PySide.QtCore.QSignalMapper.map(PySide.QtCore.QObject)

Is there some kind of a solution?

Here is a snipplet of my code:

class Picsim(QtGui.QMainWindow, Ui_MainWindow):

    cb_changed = QtCore.Signal(int)

    def __init__(self, parent=None):
        super(Picsim, self).__init__(parent)
        self._checkbox_mapper = QtCore.QSignalMapper(self)
        self._connect_checkboxes()

def _connect_checkboxes(self):
        """Connects all the CheckBoxes to _set_value_cb_mem"""
        for bank in xrange(0,2):
            for row in xrange(0,12):
                for col in xrange(0,8):
                    bank_intern = bank * 8
                    if row == 10:
                        row_intern = "A"
                    elif row == 11:
                        row_intern = "B"
                    else :
                        row_intern = row
                    cbname = "CB_" + str(bank_intern) +
str(row_intern) + str(col)
                    cb = getattr(self, cbname)
                    self._checkbox_mapper.setMapping(cb, cbname)
                    cb.stateChanged.connect(self._checkbox_mapper.map)
        self._checkbox_mapper.mapped.connect(self.cb_changed)
        self.cb_changed.connect(self._set_memvalue)

@QtCore.Slot(str)
    def _set_memvalue(self, name):
        """Sets the value of a given CheckBox to its memory
location"""
        print name
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside

Reply via email to