#include <treeselection.hpp>
Definition at line 19 of file treeselection.hpp.
◆ type_datum
◆ FilterType
◆ ~treeselection()
dbe::models::treeselection::~treeselection |
( |
| ) |
|
◆ treeselection()
dbe::models::treeselection::treeselection |
( |
QObject * | parent = 0 | ) |
|
|
explicit |
Including DBE.
Definition at line 6 of file treeselection.cpp.
7 : QSortFilterProxyModel ( parent ),
11{
13}
void model_common_connections()
◆ AcceptItem()
bool dbe::models::treeselection::AcceptItem |
( |
const QModelIndex & | SourceIndex, |
|
|
int | LevelRestriction ) const |
|
private |
Definition at line 198 of file treeselection.cpp.
200{
202 {
203 sourceModel()->fetchMore ( SourceIndex );
204 }
205
206 if ( sourceModel()->data ( SourceIndex ).toString().contains ( filterRegExp() ) )
207 {
208 return true;
209 }
210
212 {
213 return false;
214 }
215
216 for ( int i = 0; i < sourceModel()->rowCount ( SourceIndex ); ++i )
217 {
219 {
220 return true;
221 }
222 }
223
224 return false;
225}
bool canFetchMore(type_index const &index) const
bool AcceptItem(const QModelIndex &SourceIndex, int LevelRestriction) const
◆ AtDepth()
int dbe::models::treeselection::AtDepth |
( |
const QModelIndex & | SourceParent | ) |
const |
|
private |
Definition at line 275 of file treeselection.cpp.
276{
277 int Depth = 1;
278 QModelIndex CurrentIndex = SourceParent;
279
280 while ( CurrentIndex.isValid() )
281 {
282 CurrentIndex = CurrentIndex.parent();
283 Depth++;
284 }
285
286 return Depth;
287}
◆ canFetchMore()
bool dbe::models::treeselection::canFetchMore |
( |
type_index const & | index | ) |
const |
Definition at line 32 of file treeselection.cpp.
33{
34 if (
index.isValid() )
35 {
36 QModelIndex sourceParent = mapToSource ( index );
37 return sourceModel()->canFetchMore ( sourceParent );
38 }
39 else
40 {
41 return false;
42 }
43}
◆ fetchMore()
void dbe::models::treeselection::fetchMore |
( |
type_index const & | index | ) |
|
Definition at line 45 of file treeselection.cpp.
46{
47 QModelIndex sourceParent = mapToSource ( index );
48 sourceModel()->fetchMore ( sourceParent );
49}
◆ filterAcceptsRow()
bool dbe::models::treeselection::filterAcceptsRow |
( |
int | source_row, |
|
|
const QModelIndex & | source_parent ) const |
|
protected |
Definition at line 132 of file treeselection.cpp.
134{
135 treenode * NodeObject =
getnode ( sourceModel()->index ( source_row, 0, source_parent ) );
136
137 if ( dynamic_cast<AttributeNode *> ( NodeObject ) )
138 {
139 return false;
140 }
141
143 {
144 if ( !source_parent.isValid() )
145 {
146 QModelIndex Index_1 = sourceModel()->index ( source_row, 1, source_parent );
147
148 if ( sourceModel()->data ( Index_1 ).toUInt() == 0 )
149 {
150 return false;
151 }
152 }
153 }
154
156 {
159
162
163 default:
164 return true;
165 }
166}
bool RegexpFilter(int sourceRow, const QModelIndex &sourceParent) const
type_datum * getnode(type_index const &index) const override
bool ObjectFilter(int sourceRow, const QModelIndex &sourceParent) const
◆ getnode()
dbe::treenode * dbe::models::treeselection::getnode |
( |
type_index const & | index | ) |
const |
|
override |
Definition at line 72 of file treeselection.cpp.
73{
74 if (
index.isValid() )
75 {
77
78 if ( UnderlyingModel )
79 {
80 return UnderlyingModel->
getnode ( index );
81 }
82 }
83
84 return nullptr;
85}
type_datum * getnode(const type_index &index) const override
◆ GetQueryObjects()
std::vector< dbe::tref > dbe::models::treeselection::GetQueryObjects |
( |
| ) |
|
◆ hasChildren()
bool dbe::models::treeselection::hasChildren |
( |
type_index const & | index | ) |
const |
Definition at line 19 of file treeselection.cpp.
20{
21 if (
index.isValid() )
22 {
23 QModelIndex sourceParent = mapToSource ( index );
24 return sourceModel()->hasChildren ( sourceParent );
25 }
26 else
27 {
28 return true;
29 }
30}
◆ lessThan()
bool dbe::models::treeselection::lessThan |
( |
const QModelIndex & | left, |
|
|
const QModelIndex & | right ) const |
|
protected |
Definition at line 168 of file treeselection.cpp.
170{
171 if ( left.parent() == QModelIndex() || left.parent().parent() == QModelIndex() )
172 {
173 QVariant LeftData = sourceModel()->data ( left );
174 QVariant RightData = sourceModel()->data ( right );
175
176 switch ( LeftData.type() )
177 {
178 case QVariant::Bool:
179 case QVariant::UInt:
180 return ( LeftData.toUInt() < RightData.toUInt() );
181
182 case QVariant::Int:
183 return ( LeftData.toInt() < RightData.toInt() );
184
185 case QVariant::String:
186 return ( ( LeftData.toString() ).compare ( RightData.toString() ) > 0 );
187
188 default:
189 return false;
190 }
191
192 return true;
193 }
194
195 return false;
196}
◆ ObjectFilter()
bool dbe::models::treeselection::ObjectFilter |
( |
int | sourceRow, |
|
|
const QModelIndex & | sourceParent ) const |
|
private |
Definition at line 239 of file treeselection.cpp.
241{
242 QModelIndex index0 = sourceModel()->index ( sourceRow, 0, sourceParent );
243 QString id = sourceModel()->data ( index0 ).toString();
244
245 if ( ( filterRegExp() ).isEmpty() )
246 {
247 return true;
248 }
249
250 if (
AtDepth ( sourceParent ) > 2 )
251 {
252 return true;
253 }
254
255 if ( !sourceParent.isValid() )
256 {
258 if ( QString (
QueryObjects.at ( i ).class_name().c_str() ).compare (
id ) == 0 )
259 {
260 return true;
261 }
262 }
263 else
264 {
266 if (
id.compare ( QString (
QueryObjects.at ( i ).UID().c_str() ) ) == 0 )
267 {
268 return true;
269 }
270 }
271
272 return false;
273}
int AtDepth(const QModelIndex &SourceParent) const
◆ RegexpFilter()
bool dbe::models::treeselection::RegexpFilter |
( |
int | sourceRow, |
|
|
const QModelIndex & | sourceParent ) const |
|
private |
Definition at line 227 of file treeselection.cpp.
229{
231 {
232 QModelIndex index0 = sourceModel()->index ( sourceRow, 0, sourceParent );
234 }
235
236 return true;
237}
◆ ResetModel()
void dbe::models::treeselection::ResetModel |
( |
| ) |
|
Definition at line 126 of file treeselection.cpp.
127{
128 beginResetModel();
129 endResetModel();
130}
◆ ResetQueryObjects()
void dbe::models::treeselection::ResetQueryObjects |
( |
| ) |
|
◆ SetFilterRestrictionLevel()
void dbe::models::treeselection::SetFilterRestrictionLevel |
( |
int | Levels | ) |
|
◆ SetFilterType()
void dbe::models::treeselection::SetFilterType |
( |
FilterType | Filter | ) |
|
◆ SetQueryObjects()
void dbe::models::treeselection::SetQueryObjects |
( |
std::vector< tref > | Objects | ) |
|
◆ slot_create_object
void dbe::models::treeselection::slot_create_object |
( |
QString const & | src, |
|
|
dref const & | obj ) |
|
privateslot |
◆ slot_remove_object
void dbe::models::treeselection::slot_remove_object |
( |
QString const & | src, |
|
|
dref const & | obj ) |
|
privateslot |
◆ slot_rename_object
void dbe::models::treeselection::slot_rename_object |
( |
QString const & | src, |
|
|
dref const & | obj ) |
|
privateslot |
◆ slot_update_object
void dbe::models::treeselection::slot_update_object |
( |
QString const & | src, |
|
|
dref const & | obj ) |
|
privateslot |
◆ ToggleEmptyClasses
void dbe::models::treeselection::ToggleEmptyClasses |
( |
bool | HideLocal | ) |
|
|
privateslot |
◆ Hide
bool dbe::models::treeselection::Hide |
|
private |
◆ LevelRestriction
int dbe::models::treeselection::LevelRestriction |
|
private |
◆ QueryObjects
std::vector<tref> dbe::models::treeselection::QueryObjects |
|
private |
◆ Type
The documentation for this class was generated from the following files: