LeechCraft  0.6.70-15082-g543737046d
Modular cross-platform feature rich live environment.
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 
15 namespace 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 }
LC::Util::ModelItemsList_t
QVector< ModelItem_ptr > ModelItemsList_t
Definition: modelitem.h:27
LC::Util
Definition: icoreproxy.h:33
modelitembase.h
LC::Util::ModelItem_cptr
std::shared_ptr< const ModelItem > ModelItem_cptr
Definition: modelitem.h:28
modelsconfig.h
LC::Util::ModelItemBase
Base class for model items for tree-like models.
Definition: modelitembase.h:52
LC::Util::ModelItem
Provides a proxying API on top of an QAbstractItemModel.
Definition: modelitem.h:37
LC::Util::ModelItem_wtr
std::weak_ptr< ModelItem > ModelItem_wtr
Definition: modelitem.h:26
LC::Util::ModelItem_ptr
std::shared_ptr< ModelItem > ModelItem_ptr
Definition: modelitem.h:23
LC::Util::ModelItem::const_iterator
ModelItemsList_t::const_iterator const_iterator
Definition: modelitem.h:43
UTIL_MODELS_API
#define UTIL_MODELS_API
Definition: modelsconfig.h:16