LeechCraft
0.6.70-18450-gabe19ee3b0
Modular cross-platform feature rich live environment.
Toggle main menu visibility
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
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::ModelItemBase< ModelItem >::ModelItemBase
ModelItemBase()=default
LC::Util::ModelItem
Provides a proxying API on top of an QAbstractItemModel.
Definition
modelitem.h:32
LC::Util::ModelItem::EnsureChild
ModelItem * EnsureChild(int row)
Ensures there is a child item at the given row.
Definition
modelitem.cpp:21
LC::Util::ModelItem::GetModel
QAbstractItemModel * GetModel() const
Returns the wrapped model.
Definition
modelitem.cpp:45
LC::Util::ModelItem::ModelItem
ModelItem()=default
Constructs a default (invalid) ModelItem having no model set.
LC::Util::ModelItem::RefreshIndex
void RefreshIndex(int modelStartingRow)
Updates the wrapped index so that it points at the given row.
Definition
modelitem.cpp:39
LC::Util::ModelItem::GetIndex
const QModelIndex & GetIndex() const
Returns the index this ModelItem instance wraps.
Definition
modelitem.cpp:34
LC::Util::ModelItem::iterator
ModelItemsList_t::iterator iterator
Definition
modelitem.h:36
LC::Util::ModelItem::FindChild
ModelItem_ptr FindChild(QModelIndex index) const
Finds a child item for the given index.
Definition
modelitem.cpp:50
LC::Util::ModelItem::const_iterator
ModelItemsList_t::const_iterator const_iterator
Definition
modelitem.h:37
modelitembase.h
modelsconfig.h
UTIL_MODELS_API
#define UTIL_MODELS_API
Definition
modelsconfig.h:16
LC::Util
Definition
icoreproxy.h:34
LC::Util::ModelItem_ptr
std::shared_ptr< ModelItem > ModelItem_ptr
Definition
modelitem.h:19
LC::Util::ModelItemsList_t
QVector< ModelItem_ptr > ModelItemsList_t
Definition
modelitem.h:21
LC::Util::ModelItem_cptr
std::shared_ptr< const ModelItem > ModelItem_cptr
Definition
modelitem.h:22
LC::Util::ModelItem_wtr
std::weak_ptr< ModelItem > ModelItem_wtr
Definition
modelitem.h:20
src
util
models
modelitem.h
Generated by
1.17.0