16 return QModelIndex ();
18 return createIndex (row, column);
23 return QModelIndex ();
33 return parent.isValid () ? 0 : 1;
54 &QAbstractItemModel::rowsInserted,
56 &FlattenFilterModel::HandleRowsInserted);
58 &QAbstractItemModel::rowsAboutToBeRemoved,
60 &FlattenFilterModel::HandleRowsAboutRemoved);
62 &QAbstractItemModel::dataChanged,
64 &FlattenFilterModel::HandleDataChanged);
72 void FlattenFilterModel::HandleDataChanged (
const QModelIndex& top,
const QModelIndex& bottom)
74 const auto&
parent = top.parent ();
75 for (
int i = top.row (); i <= bottom.row (); ++i)
82 const auto& ourIdx =
index (pos, 0);
83 emit dataChanged (ourIdx, ourIdx);
87 void FlattenFilterModel::HandleRowsInserted (
const QModelIndex& parent,
int start,
int end)
89 for (
int i = start; i <= end; ++i)
99 if (
int rc =
Source_->rowCount (child))
100 HandleRowsInserted (child, 0, rc - 1);
104 void FlattenFilterModel::HandleRowsAboutRemoved (
const QModelIndex& parent,
int start,
int end)
106 for (
int i = start; i <= end; ++i)
113 beginRemoveRows (QModelIndex (), pos, pos);
118 if (
int rc =
Source_->rowCount (child))
119 HandleRowsAboutRemoved (child, 0, rc - 1);