DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
tree.cpp File Reference
#include "dbe/config_api.hpp"
#include "dbe/confaccessor.hpp"
#include "dbe/config_reference.hpp"
#include "dbe/tree.hpp"
#include "dbe/treenode.hpp"
#include "dbe/ui_constants.hpp"
#include "dbe/version.hpp"
#include <QMimeData>
Include dependency graph for tree.cpp:

Go to the source code of this file.

Functions

 MODEL_COMMON_INTERFACE_LOOKUP_IMPL (dbe::models::tree)
 
 MODEL_COMMON_INTERFACE_CREATE_THAT_OBJ_IMPL (dbe::models::tree)
 
 MODEL_COMMON_INTERFACE_DELETE_THAT_OBJ_IMPL (dbe::models::tree)
 
 MODEL_COMMON_INTERFACE_RENAME_THAT_OBJ_IMPL (dbe::models::tree)
 
 MODEL_COMMON_INTERFACE_UPDATE_THAT_OBJ_IMPL (dbe::models::tree)
 

Variables

char const *const dbe_lib_structure_version = dbe_compiled_version
 Including QT Headers.
 

Function Documentation

◆ MODEL_COMMON_INTERFACE_CREATE_THAT_OBJ_IMPL()

MODEL_COMMON_INTERFACE_CREATE_THAT_OBJ_IMPL ( dbe::models::tree )

Definition at line 412 of file tree.cpp.

413{
414 if ( treenode * classnode = confaccessor::gethandler()->getnode ( obj.class_name() ) )
415 {
416 if ( not dbe::datahandler::findchild ( classnode, QString::fromStdString ( obj.UID() ) ) )
417 {
418 layoutAboutToBeChanged();
419 new ObjectNode ( obj, false, classnode );
420 // Normally we would have to call changePersistentIndex.
421 // Because an objectnode is created which had no index
422 // before this creation had occured there is no need to call it.
423 emit layoutChanged();
424 }
425 }
426}
static treenode * findchild(treenode *top, QString const &name)

◆ MODEL_COMMON_INTERFACE_DELETE_THAT_OBJ_IMPL()

MODEL_COMMON_INTERFACE_DELETE_THAT_OBJ_IMPL ( dbe::models::tree )

Definition at line 428 of file tree.cpp.

429{
430 if ( index.isValid() )
431 {
432 this->removeRows ( index.row(), 1, index.parent() );
433 }
434}

◆ MODEL_COMMON_INTERFACE_LOOKUP_IMPL()

MODEL_COMMON_INTERFACE_LOOKUP_IMPL ( dbe::models::tree )

Definition at line 386 of file tree.cpp.

387{
388 if ( treenode * classnode = confaccessor::gethandler()->getnode (
389 QString::fromStdString ( obj.class_name() ) ) )
390 {
391
392 auto found = [&obj, classnode] ( int i )
393 {
394 return obj.UID() == classnode->GetChild ( i )->GetData ( 0 ).toString().toStdString();
395 };
396
397 int i = 0;
398 int const childs = classnode->ChildCount();
399
400 for ( ; i < childs and not found ( i ); ++i )
401
402 ;
403
404 QModelIndex parent_index = getindex ( classnode );
405
406 return childs == i ? QModelIndex() : index ( i, parent_index.column(), parent_index );
407 }
408
409 return QModelIndex();
410}

◆ MODEL_COMMON_INTERFACE_RENAME_THAT_OBJ_IMPL()

MODEL_COMMON_INTERFACE_RENAME_THAT_OBJ_IMPL ( dbe::models::tree )

Definition at line 436 of file tree.cpp.

437{
438 if ( index.isValid() )
439 {
440 treenode * child = getnode ( index );
441 child->rename ( QString::fromStdString ( obj.ref().UID() ) );
442 emit dataChanged ( index, index );
443 }
444}

◆ MODEL_COMMON_INTERFACE_UPDATE_THAT_OBJ_IMPL()

MODEL_COMMON_INTERFACE_UPDATE_THAT_OBJ_IMPL ( dbe::models::tree )

Definition at line 446 of file tree.cpp.

447{
448 // Some form of change has occured , we remove and insert a new object node
449 // for the specified object
450 if ( index.isValid() )
451 {
452 // This in the worst case return a pointer to root in the tree
453 treenode * child = getnode ( index );
454
455 if ( treenode * parent = child->GetParent() )
456 {
457 emit layoutAboutToBeChanged();
458 parent->RemoveChild ( child );
459 new ObjectNode ( obj, false, parent );
460 emit layoutChanged();
461 }
462 }
463}

Variable Documentation

◆ dbe_lib_structure_version

char const* const dbe_lib_structure_version = dbe_compiled_version

Including QT Headers.

Including TDAq Including DBE

Definition at line 11 of file tree.cpp.