37 : QAbstractItemModel (parent)
45 return QModelIndex ();
47 return createIndex (row, column);
52 return QModelIndex ();
62 return parent.isValid () ? 0 : 1;
75 SIGNAL (rowsInserted (QModelIndex,
int,
int)),
77 SLOT (handleRowsInserted (QModelIndex,
int,
int)));
79 SIGNAL (rowsAboutToBeRemoved (QModelIndex,
int,
int)),
81 SLOT (handleRowsAboutRemoved (QModelIndex,
int,
int)));
83 SIGNAL (dataChanged (QModelIndex, QModelIndex)),
85 SLOT (handleDataChanged (QModelIndex, QModelIndex)));
93 SIGNAL (rowsInserted (QModelIndex,
int,
int)),
95 SLOT (handleRowsInserted (QModelIndex,
int,
int)));
97 SIGNAL (rowsAboutToBeRemoved (QModelIndex,
int,
int)),
99 SLOT (handleRowsAboutRemoved (QModelIndex,
int,
int)));
101 SIGNAL (dataChanged (QModelIndex, QModelIndex)),
103 SLOT (handleDataChanged (QModelIndex, QModelIndex)));
111 void FlattenFilterModel::handleDataChanged (
const QModelIndex& top,
const QModelIndex& bottom)
113 const auto&
parent = top.parent ();
114 for (
int i = top.row (); i <= bottom.row (); ++i)
121 const auto& ourIdx =
index (pos, 0);
122 emit dataChanged (ourIdx, ourIdx);
126 void FlattenFilterModel::handleRowsInserted (
const QModelIndex& parent,
int start,
int end)
128 for (
int i = start; i <= end; ++i)
138 if (
int rc =
Source_->rowCount (child))
139 handleRowsInserted (child, 0, rc - 1);
143 void FlattenFilterModel::handleRowsAboutRemoved (
const QModelIndex& parent,
int start,
int end)
145 for (
int i = start; i <= end; ++i)
152 beginRemoveRows (QModelIndex (), pos, pos);
157 if (
int rc =
Source_->rowCount (child))
158 handleRowsAboutRemoved (child, 0, rc - 1);