57 const auto& childIdx = Model_->index (row, 0, SrcIdx_);
58 Children_ [row] = std::make_shared<ModelItem> (Model_, childIdx, shared_from_this ());
69 if (SrcIdx_.isValid ())
70 SrcIdx_ = Model_->index (
GetRow () - modelStartingRow, 0,
Parent_.lock ()->GetIndex ());
80 index = index.sibling (index.row (), 0);
83 [&index] (
const ModelItem_ptr& item) {
return item->GetIndex () == index; });
std::shared_ptr< ModelItem > ModelItem_ptr
detail::ExprTree< detail::ExprType::LeafStaticPlaceholder, boost::mpl::int_< Idx > > pos
const QModelIndex & GetIndex() const
Returns the index this ModelItem instance wraps.
int GetRow() const
Returns the index of this item in the parent's children list.
QAbstractItemModel * GetModel() const
Returns the wrapped model.
std::weak_ptr< ModelItem > ModelItem_wtr
ModelItem_ptr FindChild(QModelIndex index) const
Finds a child item for the given index.
Base class for model items for tree-like models.
void RefreshIndex(int modelStartingRow)
Updates the wrapped index so that it points at the given row.
ModelItem * EnsureChild(int row)
Ensures there is a child item at the given row.
Provides a proxying API on top of an QAbstractItemModel.
ModelItem()
Constructs a default (invalid) ModelItem having no model set.