LeechCraft 0.6.70-16373-g319c272718
Modular cross-platform feature rich live environment.
Loading...
Searching...
No Matches
modelitem.h
Go to the documentation of this file.
1/**********************************************************************
2 * LeechCraft - modular cross-platform feature rich internet client.
3 * Copyright (C) 2006-2014 Georg Rudoy
4 *
5 * Distributed under the Boost Software License, Version 1.0.
6 * (See accompanying file LICENSE or copy at https://www.boost.org/LICENSE_1_0.txt)
7 **********************************************************************/
8
9#pragma once
10
11#include <QModelIndex>
12#include "modelsconfig.h"
13#include "modelitembase.h"
14
15namespace LC::Util
16{
17 class ModelItem;
18
19 typedef std::shared_ptr<ModelItem> ModelItem_ptr;
20 typedef std::weak_ptr<ModelItem> ModelItem_wtr;
21 typedef QVector<ModelItem_ptr> ModelItemsList_t;
22 typedef std::shared_ptr<const ModelItem> ModelItem_cptr;
23
31 class UTIL_MODELS_API ModelItem final : public ModelItemBase<ModelItem>
32 {
33 QAbstractItemModel * const Model_ = nullptr;
34 QModelIndex SrcIdx_;
35 public:
36 typedef ModelItemsList_t::iterator iterator;
37 typedef ModelItemsList_t::const_iterator const_iterator;
38
42 ModelItem () = default;
43
52 ModelItem (QAbstractItemModel *model, const QModelIndex& index, const ModelItem_wtr& parent);
53
66 ModelItem* EnsureChild (int row);
67
74 const QModelIndex& GetIndex () const;
75
80 QAbstractItemModel* GetModel () const;
81
93 void RefreshIndex (int modelStartingRow);
94
105 ModelItem_ptr FindChild (QModelIndex index) const;
106 };
107}
Base class for model items for tree-like models.
Provides a proxying API on top of an QAbstractItemModel.
Definition modelitem.h:32
ModelItem()=default
Constructs a default (invalid) ModelItem having no model set.
ModelItemsList_t::iterator iterator
Definition modelitem.h:36
ModelItemsList_t::const_iterator const_iterator
Definition modelitem.h:37
#define UTIL_MODELS_API
Container< T > Filter(const Container< T > &c, F f)
Definition prelude.h:118
std::shared_ptr< ModelItem > ModelItem_ptr
Definition modelitem.h:19
QVector< ModelItem_ptr > ModelItemsList_t
Definition modelitem.h:21
std::shared_ptr< const ModelItem > ModelItem_cptr
Definition modelitem.h:22
std::weak_ptr< ModelItem > ModelItem_wtr
Definition modelitem.h:20