diff --git a/src/14 QAbstractTableModel example/README.md b/src/14 QAbstractTableModel example/README.md index 753c195..501abee 100644 --- a/src/14 QAbstractTableModel example/README.md +++ b/src/14 QAbstractTableModel example/README.md @@ -31,12 +31,12 @@ class TableModel(QAbstractTableModel): # How many columns? return len(headers) def data(self, index, role): - if role != Qt.DisplayRole: + if role != Qt.ItemDataRole.DisplayRole: return QVariant() # What's the value of the cell at the given index? return rows[index.row()][index.column()] def headerData(self, section, orientation, role): - if role != Qt.DisplayRole or orientation != Qt.Horizontal: + if role != Qt.ItemDataRole.DisplayRole or orientation != Qt.Orientation.Horizontal: return QVariant() # What's the header for the given column? return headers[section] diff --git a/src/14 QAbstractTableModel example/main.py b/src/14 QAbstractTableModel example/main.py index f170e9e..57d6102 100644 --- a/src/14 QAbstractTableModel example/main.py +++ b/src/14 QAbstractTableModel example/main.py @@ -12,11 +12,11 @@ class TableModel(QAbstractTableModel): def columnCount(self, parent): return len(headers) def data(self, index, role): - if role != Qt.DisplayRole: + if role != Qt.ItemDataRole.DisplayRole: return QVariant() return rows[index.row()][index.column()] def headerData(self, section, orientation, role): - if role != Qt.DisplayRole or orientation != Qt.Horizontal: + if role != Qt.ItemDataRole.DisplayRole or orientation != Qt.Orientation.Horizontal: return QVariant() return headers[section]