def __lt__(self, other): if (isinstance(other, QCustomTableWidgetItem)): selfDataValue = float(self.data(Qt.EditRole)) otherDataValue = float(other.data(Qt.EditRole)) return selfDataValue < otherDataValue else: return QTableWidgetItem.__lt__(self, other)
def __lt__(self, other): if isinstance(other, NumericTableWidgetItem): myData = self.data(Qt.EditRole) otherData = other.data(Qt.EditRole) if myData == "": return True elif otherData == "": return False else: return int(myData) < int(otherData) else: return QTableWidgetItem.__lt__(self, other)