Commit a39516e9 authored by Bernhard Beschow's avatar Bernhard Beschow

no need for overriding hasChildren(); rely on rowCount() instead

parent 6ce56e28
......@@ -458,18 +458,6 @@ QModelIndex TargetModel::index(int row, int column, const QModelIndex &parent) c
return createIndex(row, column, rootIndex);
bool TargetModel::hasChildren (const QModelIndex &parent) const
if (!parent.isValid()) return !m_targets.isEmpty();
if (parent.internalId() != InvalidIndex) return false;
if (parent.column() != 0) return false;
int row = parent.row();
if (row < 0 || row >= m_targets.size()) return false;
return m_targets[row].commands.size() > 0;
QModelIndex TargetModel::parent(const QModelIndex &child) const
if (child.internalId() == InvalidIndex) return QModelIndex();
......@@ -88,7 +88,6 @@ public:
QModelIndex parent(const QModelIndex &child) const Q_DECL_OVERRIDE;
int rowCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
int columnCount(const QModelIndex &parent = QModelIndex()) const Q_DECL_OVERRIDE;
bool hasChildren(const QModelIndex & parent = QModelIndex()) const Q_DECL_OVERRIDE;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment