From f23cbb21965ee1611353b061fa57888a0b7da9c3 Mon Sep 17 00:00:00 2001 From: dongliu Date: Wed, 18 May 2022 15:38:21 +0800 Subject: [PATCH] Fix 14 QAbstractTableModel example --- src/14 QAbstractTableModel example/README.md | 4 ++-- src/14 QAbstractTableModel example/main.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) 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]