class Node(object):....def setName(self, name):print self._name, namecmds.rename(self._name, name)self._name=name
def setData(self, index, value, role=QtCore.Qt.EditRole):if index.isValid():
if role ==QtCore.Qt.EditRole:
node = index.internalPointer()
oldName = node.name()node.setName(value)
self.dataChanged.emit(index, index)self.nameChanged.emit(node, oldName, value)return Truereturn False# some other function or method as a slotdef nodeNameChanged(node, oldName, newName):print node, "name was changed from", oldName, "to", newNamecmds.rename(oldName, newName)myModel = SceneGraphModel()myModel.nameChanged.connect(nodeNameChanged)
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/e2f648f4-8910-4309-8d64-6d31f9c09bfe%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Sorry my mistake on that. I have been doing so much PySide these days that I forgot about the QVariant return value. It is a C++ hold over to allow them to box different types into one interface. But it was removed in PySide or if you use PyQt with the SIP api set to version 2.
Glad you worked that one out!
Hi ,got it to work! I just converted the QVariant Object into a string (eg: newname.toString).
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/58d2ab01-9d15-4065-a457-a55582887faa%40googlegroups.com.