(self, index, role=QtCore.Qt.DisplayRole)
| 26 | self._model_data = modelData |
| 27 | |
| 28 | def data(self, index, role=QtCore.Qt.DisplayRole): |
| 29 | if not index.isValid(): |
| 30 | return QSqlQueryModel.data(self, index, role) |
| 31 | |
| 32 | column = index.column() |
| 33 | row = index.row() |
| 34 | |
| 35 | if role == QtCore.Qt.TextAlignmentRole: |
| 36 | return QtCore.Qt.AlignCenter |
| 37 | if role == QtCore.Qt.TextColorRole: |
| 38 | for _, what in enumerate(self._model_data): |
| 39 | d = QSqlQueryModel.data(self, self.index(row, self._model_data[what][1]), QtCore.Qt.DisplayRole) |
| 40 | if column == self._model_data[what][1] and what in d: |
| 41 | return self._model_data[what][0] |
| 42 | |
| 43 | return QSqlQueryModel.data(self, index, role) |
| 44 | |
| 45 | class ConnectionsTableModel(QStandardItemModel): |
| 46 | rowCountChanged = pyqtSignal() |
no test coverage detected