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 419 of file tree.cpp.

420{
421 Q_UNUSED(index);
422 if ( treenode * classnode = confaccessor::gethandler()->getnode ( obj.class_name() ) )
423 {
424 if ( not dbe::datahandler::findchild ( classnode, QString::fromStdString ( obj.UID() ) ) )
425 {
426 layoutAboutToBeChanged();
427 new ObjectNode ( obj, false, classnode );
428 // Normally we would have to call changePersistentIndex.
429 // Because an objectnode is created which had no index
430 // before this creation had occured there is no need to call it.
431 emit layoutChanged();
432 }
433 }
434}
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 436 of file tree.cpp.

437{
438 if ( index.isValid() )
439 {
440 this->removeRows ( index.row(), 1, index.parent() );
441 }
442}

◆ MODEL_COMMON_INTERFACE_LOOKUP_IMPL()

MODEL_COMMON_INTERFACE_LOOKUP_IMPL ( dbe::models::tree )

Definition at line 393 of file tree.cpp.

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

◆ MODEL_COMMON_INTERFACE_RENAME_THAT_OBJ_IMPL()

MODEL_COMMON_INTERFACE_RENAME_THAT_OBJ_IMPL ( dbe::models::tree )

Definition at line 444 of file tree.cpp.

445{
446 if ( index.isValid() )
447 {
448 treenode * child = getnode ( index );
449 child->rename ( QString::fromStdString ( obj.ref().UID() ) );
450 emit dataChanged ( index, index );
451 }
452}

◆ MODEL_COMMON_INTERFACE_UPDATE_THAT_OBJ_IMPL()

MODEL_COMMON_INTERFACE_UPDATE_THAT_OBJ_IMPL ( dbe::models::tree )

Definition at line 454 of file tree.cpp.

455{
456 // Some form of change has occured , we remove and insert a new object node
457 // for the specified object
458 if ( index.isValid() )
459 {
460 // This in the worst case return a pointer to root in the tree
461 treenode * child = getnode ( index );
462
463 if ( treenode * parent = child->GetParent() )
464 {
465 emit layoutAboutToBeChanged();
466 parent->RemoveChild ( child );
467 new ObjectNode ( obj, false, parent );
468 emit layoutChanged();
469 }
470 }
471}

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.