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

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

442{
443 if ( index.isValid() )
444 {
445 this->removeRows ( index.row(), 1, index.parent() );
446 }
447}

◆ MODEL_COMMON_INTERFACE_LOOKUP_IMPL()

MODEL_COMMON_INTERFACE_LOOKUP_IMPL ( dbe::models::tree )

Definition at line 398 of file tree.cpp.

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

◆ MODEL_COMMON_INTERFACE_RENAME_THAT_OBJ_IMPL()

MODEL_COMMON_INTERFACE_RENAME_THAT_OBJ_IMPL ( dbe::models::tree )

Definition at line 449 of file tree.cpp.

450{
451 if ( index.isValid() )
452 {
453 treenode * child = getnode ( index );
454 child->rename ( QString::fromStdString ( obj.ref().UID() ) );
455 emit dataChanged ( index, index );
456 }
457}

◆ MODEL_COMMON_INTERFACE_UPDATE_THAT_OBJ_IMPL()

MODEL_COMMON_INTERFACE_UPDATE_THAT_OBJ_IMPL ( dbe::models::tree )

Definition at line 459 of file tree.cpp.

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

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