Added default invalid parentIndex to TableModel::columnCount and added Q_UNUSED macro to suppress warnings.
This commit is contained in:
@ -30,9 +30,15 @@ Qt::ItemFlags TableModel::flags(const QModelIndex& index) const {
|
|||||||
|
|
||||||
QHash<int, QByteArray> TableModel::roleNames() const { return ROLE_NAMES; }
|
QHash<int, QByteArray> TableModel::roleNames() const { return ROLE_NAMES; }
|
||||||
|
|
||||||
int TableModel::rowCount(const QModelIndex& parent) const { return m_items.size(); }
|
int TableModel::rowCount(const QModelIndex& parent) const {
|
||||||
|
Q_UNUSED(parent);
|
||||||
|
return m_items.size();
|
||||||
|
}
|
||||||
|
|
||||||
int TableModel::columnCount(const QModelIndex& parent) const { return ROLE_NAMES.size(); }
|
int TableModel::columnCount(const QModelIndex& parent) const {
|
||||||
|
Q_UNUSED(parent);
|
||||||
|
return ROLE_NAMES.size();
|
||||||
|
}
|
||||||
|
|
||||||
QVariant TableModel::data(const QModelIndex& index, int role) const {
|
QVariant TableModel::data(const QModelIndex& index, int role) const {
|
||||||
const int row = index.row();
|
const int row = index.row();
|
||||||
|
|||||||
@ -21,7 +21,7 @@ class TableModel : public QAbstractTableModel {
|
|||||||
QHash<int, QByteArray> roleNames() const override;
|
QHash<int, QByteArray> roleNames() const override;
|
||||||
|
|
||||||
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
int rowCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
int columnCount(const QModelIndex& parent) const override;
|
int columnCount(const QModelIndex& parent = QModelIndex()) const override;
|
||||||
QVariant data(const QModelIndex& index, int role) const override;
|
QVariant data(const QModelIndex& index, int role) const override;
|
||||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user