def testSignals(self): self._called = False m = QStringListModel() m.rowsAboutToBeInserted[QModelIndex, int, int].connect(self.sigCallback) m.insertRows(0, 3) self.assertTrue(self._called)
from PySide2.QtCore import Qt, QPersistentModelIndex from PySide2.QtGui import QStringListModel if __name__ == '__main__': stringListModel = QStringListModel(['one', 'two']) idx = stringListModel.index(1, 0) persistentModelIndex = QPersistentModelIndex(idx) stringListModel.data(persistentModelIndex, Qt.DisplayRole)