示例#1
0
 def testSignals(self):
     self._called = False
     m = QStringListModel()
     m.rowsAboutToBeInserted[QModelIndex, int,
                             int].connect(self.sigCallback)
     m.insertRows(0, 3)
     self.assertTrue(self._called)
示例#2
0
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)

示例#3
0
 def testSignals(self):
     self._called = False
     m = QStringListModel()
     m.rowsAboutToBeInserted[QModelIndex,int,int].connect(self.sigCallback)
     m.insertRows(0, 3)
     self.assert_(self._called)