DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
tree.cpp File Reference
#include "dbe/tree.hpp"
#include "dbe/StyleUtility.hpp"
#include "dbe/confaccessor.hpp"
#include "dbe/config_api.hpp"
#include "dbe/config_reference.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 401 of file tree.cpp.

402{
403 Q_UNUSED(index);
404 if (treenode* classnode = confaccessor::gethandler()->getnode(obj.class_name())) {
405 if (not dbe::datahandler::findchild(classnode, QString::fromStdString(obj.UID()))) {
406 layoutAboutToBeChanged();
407 new ObjectNode(obj, false, classnode);
408 // Normally we would have to call changePersistentIndex.
409 // Because an objectnode is created which had no index
410 // before this creation had occured there is no need to call it.
411 emit layoutChanged();
412 }
413 }
414}
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 416 of file tree.cpp.

417{
418 if (index.isValid()) {
419 this->removeRows(index.row(), 1, index.parent());
420 }
421}

◆ MODEL_COMMON_INTERFACE_LOOKUP_IMPL()

MODEL_COMMON_INTERFACE_LOOKUP_IMPL ( dbe::models::tree )

Definition at line 378 of file tree.cpp.

379{
380 if (treenode* classnode = confaccessor::gethandler()->getnode(QString::fromStdString(obj.class_name()))) {
381
382 auto found = [&obj, classnode](int i) {
383 return obj.UID() == classnode->GetChild(i)->GetData(0).toString().toStdString();
384 };
385
386 int i = 0;
387 int const childs = classnode->ChildCount();
388
389 for (; i < childs and not found(i); ++i)
390
391 ;
392
393 QModelIndex parent_index = getindex(classnode);
394
395 return childs == i ? QModelIndex() : index(i, parent_index.column(), parent_index);
396 }
397
398 return QModelIndex();
399}

◆ MODEL_COMMON_INTERFACE_RENAME_THAT_OBJ_IMPL()

MODEL_COMMON_INTERFACE_RENAME_THAT_OBJ_IMPL ( dbe::models::tree )

Definition at line 423 of file tree.cpp.

424{
425 if (index.isValid()) {
426 treenode* child = getnode(index);
427 child->rename(QString::fromStdString(obj.ref().UID()));
428 emit dataChanged(index, index);
429 }
430}

◆ MODEL_COMMON_INTERFACE_UPDATE_THAT_OBJ_IMPL()

MODEL_COMMON_INTERFACE_UPDATE_THAT_OBJ_IMPL ( dbe::models::tree )

Definition at line 432 of file tree.cpp.

433{
434 // Some form of change has occured , we remove and insert a new object node
435 // for the specified object
436 if (index.isValid()) {
437 // This in the worst case return a pointer to root in the tree
438 treenode* child = getnode(index);
439
440 if (treenode* parent = child->GetParent()) {
441 emit layoutAboutToBeChanged();
442 parent->RemoveChild(child);
443 new ObjectNode(obj, false, parent);
444 emit layoutChanged();
445 }
446 }
447}

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