12 : QSortFilterProxyModel ( parent ),
26 if ( index.isValid() )
28 QModelIndex sourceParent = mapToSource ( index );
29 return sourceModel()->hasChildren ( sourceParent );
39 if ( index.isValid() )
41 QModelIndex sourceParent = mapToSource ( index );
42 return sourceModel()->canFetchMore ( sourceParent );
52 QModelIndex sourceParent = mapToSource ( index );
53 sourceModel()->fetchMore ( sourceParent );
79 if ( index.isValid() )
83 if ( UnderlyingModel )
85 return UnderlyingModel->
getnode ( index );
95 if ( index.isValid() )
97 QModelIndex sourceParent = mapToSource ( index );
106 throw daq::dbe::cannot_handle_invalid_qmodelindex (
ERS_HERE );
111 QModelIndex sourceParent = mapToSource ( index );
113 if ( dbe::models::tree * my =
dynamic_cast<dbe::models::tree *
> ( sourceModel() ) )
115 return my->
getclass ( sourceParent );
118 return dunedaq::conffwk::class_t();
123 return sourceModel();
138 type_index
const & source_parent )
const
140 treenode * NodeObject =
getnode ( sourceModel()->index ( source_row, 0, source_parent ) );
149 if ( !source_parent.isValid() )
151 QModelIndex Index_1 = sourceModel()->index ( source_row, 1, source_parent );
153 if ( sourceModel()->data ( Index_1 ).toUInt() == 0 )
174 type_index
const & right )
const
176 if ( left.parent() == QModelIndex() || left.parent().parent() == QModelIndex() )
178 QVariant LeftData = sourceModel()->data ( left );
179 QVariant RightData = sourceModel()->data ( right );
181 switch ( LeftData.type() )
185 return ( LeftData.toUInt() < RightData.toUInt() );
188 return ( LeftData.toInt() < RightData.toInt() );
190 case QVariant::String:
191 return ( ( LeftData.toString() ).compare ( RightData.toString() ) > 0 );
208 sourceModel()->fetchMore ( SourceIndex );
211 if ( sourceModel()->data ( SourceIndex ).toString().contains ( filterRegExp() ) )
221 for (
int i = 0; i < sourceModel()->rowCount ( SourceIndex ); ++i )
233 type_index
const & sourceParent )
const
237 QModelIndex index0 = sourceModel()->index ( sourceRow, 0, sourceParent );
245 type_index
const & sourceParent )
const
247 QModelIndex index0 = sourceModel()->index ( sourceRow, 0, sourceParent );
248 QString
id = sourceModel()->data ( index0 ).toString();
250 if ( ( filterRegExp() ).isEmpty() )
255 if (
AtDepth ( sourceParent ) > 2 )
260 if ( !sourceParent.isValid() )
263 if ( QString (
QueryObjects.at ( i ).class_name().c_str() ).compare (
id ) == 0 )
271 if (
id.compare ( QString (
QueryObjects.at ( i ).UID().c_str() ) ) == 0 )
283 QModelIndex CurrentIndex = SourceParent;
285 while ( CurrentIndex.isValid() )
287 CurrentIndex = CurrentIndex.parent();
305 QString::fromStdString ( obj.class_name() ) ) )
308 auto found = [&obj, classnode] (
int i )
310 return obj.UID() == classnode->GetChild ( i )->GetData ( 0 ).toString().toStdString();
314 int const childs = classnode->ChildCount();
316 for ( ; i < childs and not found ( i ); ++i )
319 return i == childs ? QModelIndex() : index ( i, 0, QModelIndex() );
322 return QModelIndex();
345 type_index
const mapped_index = this->mapFromSource ( index );
346 emit dataChanged ( mapped_index, mapped_index );
352 type_index
const mapped_index = this->mapFromSource ( index );
353 emit dataChanged ( mapped_index, mapped_index );
#define TREEMODEL_REMOVE_ROWS_DEF(classname)
static cptr< datahandler > gethandler()
void model_common_connections()
type_datum * getnode(const type_index &index) const override
int AtDepth(const QModelIndex &SourceParent) const
void SetFilterType(FilterType Filter)
bool canFetchMore(type_index const &index) const
treeselection(QObject *parent=0)
Including DBE.
std::vector< tref > QueryObjects
bool hasChildren(type_index const &index) const
bool RegexpFilter(int sourceRow, const QModelIndex &sourceParent) const
std::vector< dbe::tref > GetQueryObjects()
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const
type_datum * getnode(type_index const &index) const override
bool ObjectFilter(int sourceRow, const QModelIndex &sourceParent) const
void ToggleEmptyClasses(bool HideLocal)
void SetQueryObjects(std::vector< tref > Objects)
bool lessThan(const QModelIndex &left, const QModelIndex &right) const
void SetFilterRestrictionLevel(int Levels)
bool AcceptItem(const QModelIndex &SourceIndex, int LevelRestriction) const
void fetchMore(type_index const &index)
#define MODEL_COMMON_INTERFACE_LOOKUP_IMPL(classname)
#define MODEL_COMMON_INTERFACE_RENAME_THAT_OBJ_IMPL(classname)
#define MODEL_COMMON_INTERFACE_UPDATE_THAT_OBJ_IMPL(classname)
#define MODEL_COMMON_INTERFACE_DELETE_THAT_OBJ_IMPL(classname)
#define MODEL_COMMON_INTERFACE_SLOTS_DEF(classname)
#define MODEL_COMMON_INTERFACE_CREATE_THAT_OBJ_IMPL(classname)
inner::configobject::tref tref
virtual type_class_info getclass(type_index const &index) const =0
virtual type_object_ref getobject(type_index const &index) const =0
virtual QAbstractItemModel * ReturnSourceModel() const =0