Added QAbstractItemModelTester to main and proxy model. And fixing errors in functions flags(...), rowCount(...) and columnCount(...).
This commit is contained in:
@ -39,18 +39,25 @@ TableModel::TableModel(QUndoStack* undoStack, QObject* parent)
|
||||
, m_undoStack(undoStack) {}
|
||||
|
||||
Qt::ItemFlags TableModel::flags(const QModelIndex& index) const {
|
||||
if (!index.isValid()) {
|
||||
return QAbstractTableModel::flags(index);
|
||||
}
|
||||
return Qt::ItemIsEditable | QAbstractTableModel::flags(index);
|
||||
}
|
||||
|
||||
QHash<int, QByteArray> TableModel::roleNames() const { return ROLE_NAMES; }
|
||||
|
||||
int TableModel::rowCount(const QModelIndex& parent) const {
|
||||
Q_UNUSED(parent);
|
||||
if (parent.isValid()) {
|
||||
return 0; // no children
|
||||
}
|
||||
return m_items.size();
|
||||
}
|
||||
|
||||
int TableModel::columnCount(const QModelIndex& parent) const {
|
||||
Q_UNUSED(parent);
|
||||
if (parent.isValid()) {
|
||||
return 0; // no children
|
||||
}
|
||||
return ROLE_NAMES.size();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user