DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
GraphicalClass.cpp
Go to the documentation of this file.
1// DUNE DAQ modification notice:
2// This file has been modified from the original ATLAS dbe source for the DUNE DAQ project.
3// Fork baseline commit: dbe-02-12-17 (2022-05-12).
4// Renamed since fork: no.
5
10#include "dbe/treenode.hpp"
11
12#include <QApplication>
13#include <QBitmap>
14#include <QComboBox>
15#include <QDrag>
16#include <QGraphicsObject>
17#include <QGraphicsScene>
18#include <QGraphicsSceneMouseEvent>
19#include <QHBoxLayout>
20#include <QLabel>
21#include <QMessageBox>
22#include <QMimeData>
23#include <QPainter>
24#include <QPushButton>
25
26//------------------------------------------------------------------------------------------
27dbe::GraphicalObject::GraphicalObject(bool Used, QString ObjectName, GraphicalClass GraphInfo, QGraphicsObject* parent)
28 : QGraphicsObject(parent)
29 , GraphicalInfo(GraphInfo)
30 , IconItem(nullptr)
31 , TextItem(nullptr)
33 , DatabaseUidName(ObjectName)
34 , IsExpanded(false)
35 , IsFetched(false)
36 , expandedX(0)
37 , expandedY(0)
38{
39 setAcceptDrops(true);
40 setFlag(ItemIsMovable);
41
42 QPixmap Icon;
43
44 if (Used) {
45 if (!GraphInfo.UsedPixmapFile.isEmpty())
46 Icon = QPixmap(":/Images/" + GraphInfo.UsedPixmapFile);
47 else {
48 Icon = QPixmap(":/Images/" + GraphInfo.GenericPixmapFile);
49 }
50 } else {
51 Icon = QPixmap(":/Images/" + GraphInfo.GenericPixmapFile);
52 }
53
54 QBitmap IconMask = Icon.createHeuristicMask();
55 Icon.setMask(IconMask);
56
57 IconItem = new QGraphicsPixmapItem(Icon);
58 TextItem = new QGraphicsTextItem(ObjectName);
59}
60//------------------------------------------------------------------------------------------
61
62//------------------------------------------------------------------------------------------
68//------------------------------------------------------------------------------------------
69
70//------------------------------------------------------------------------------------------
71QRectF
73{
74 QRectF Boundarie;
75 Boundarie.setHeight(IconItem->boundingRect().height() + TextItem->boundingRect().height());
76
77 if (IconItem->boundingRect().width() > TextItem->boundingRect().width())
78 Boundarie.setWidth(IconItem->boundingRect().width());
79 else {
80 Boundarie.setWidth(TextItem->boundingRect().width());
81 }
82
83 return Boundarie;
84}
85//------------------------------------------------------------------------------------------
86
87//------------------------------------------------------------------------------------------
88void
89dbe::GraphicalObject::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
90{
91 Q_UNUSED(option)
92 Q_UNUSED(widget)
93
94 QFontMetrics Metric(QFont("Helvetica", 10));
95 painter->setFont(QFont("Helvetica", 10));
96 painter->drawPixmap(IconItem->boundingRect(), IconItem->pixmap(), IconItem->boundingRect());
97 painter->drawText(IconItem->boundingRect().bottomLeft() + QPointF(0, Metric.boundingRect(DatabaseUidName).height()),
99}
100//------------------------------------------------------------------------------------------
101
102//------------------------------------------------------------------------------------------
103QPainterPath
105{
106 QPainterPath Path;
107 Path.addRect(IconItem->boundingRect());
108 return Path;
109}
110//------------------------------------------------------------------------------------------
111
112//------------------------------------------------------------------------------------------
113void
114dbe::GraphicalObject::mouseDoubleClickEvent(QGraphicsSceneMouseEvent* event)
115{
116 if (!IsFetched) {
118 }
119
120 if (!IsExpanded) {
122 } else {
124 }
125
126 update();
127 QGraphicsItem::mouseDoubleClickEvent(event);
128}
129//------------------------------------------------------------------------------------------
130
131//------------------------------------------------------------------------------------------
132void
133dbe::GraphicalObject::mousePressEvent(QGraphicsSceneMouseEvent* event)
134{
135 if (event->button() == Qt::LeftButton) {
136 StartDrag = event->pos();
137 }
138}
139//------------------------------------------------------------------------------------------
140
141//------------------------------------------------------------------------------------------
142void
143dbe::GraphicalObject::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
144{
145 if (!(event->buttons() & Qt::LeftButton)) {
146 return;
147 }
148
149 if ((event->pos() - StartDrag).manhattanLength() < QApplication::startDragDistance()) {
150 return;
151 }
152
153 QDrag* drag = new QDrag(event->widget());
154 QPixmap Icon = IconItem->pixmap();
155
156 QStringList DataList;
157 QMimeData* mimeData = new QMimeData;
158 QByteArray ItemData;
159 QDataStream DataStream(&ItemData, QIODevice::WriteOnly);
160
161 DataList.append(QString(DatabaseUidName));
162 DataList.append(QString(DatabaseClassName));
163 DataStream << DataList;
164 mimeData->setData("application/vnd.text.list", ItemData);
165
166 drag->setMimeData(mimeData);
167 drag->setPixmap(Icon);
168
169 Qt::DropAction dropAction = drag->exec();
170 Q_UNUSED(dropAction)
171}
172//------------------------------------------------------------------------------------------
173
174//------------------------------------------------------------------------------------------
175void
176dbe::GraphicalObject::dropEvent(QGraphicsSceneDragDropEvent* event)
177{
178 QByteArray encodedData = event->mimeData()->data("application/vnd.text.list");
179 QDataStream stream(&encodedData, QIODevice::ReadOnly);
180 QList<QStringList> NewItems;
181
182 while (!stream.atEnd()) {
183 QStringList Text;
184 stream >> Text;
185 NewItems << Text;
186 }
187
188 QStringList ObjectList;
189
190 for (QStringList& i : NewItems) {
191 ObjectList.append(i.at(0));
192 }
193
194 for (int i = 0; i < NewItems.size(); ++i) {
195 if (NewItems.at(0).at(1) != NewItems.at(i).at(1)) {
196 return;
197 }
198 }
199
200 QStringList PossibleRelationships;
201 QString ClassName = NewItems.at(0).at(1);
202
203 dunedaq::conffwk::class_t ClassInfoReceiverObject =
205 std::vector<dunedaq::conffwk::relationship_t> RelationshipList = ClassInfoReceiverObject.p_relationships;
206
207 for (dunedaq::conffwk::relationship_t& i : RelationshipList) {
208 if (i.p_type == ClassName.toStdString())
209 PossibleRelationships.append(QString::fromStdString(i.p_name));
210
211 dunedaq::conffwk::class_t ClassInfoDroppedObject = dbe::config::api::info::onclass::definition(i.p_type, false);
212 std::vector<std::string> RelationshipListDropped = ClassInfoDroppedObject.p_subclasses;
213
214 for (std::string& j : RelationshipListDropped) {
215 if (j == ClassName.toStdString())
216 PossibleRelationships.append(QString::fromStdString(i.p_name));
217 }
218 }
219
220 QString SelectedRelationship;
221
222 if (PossibleRelationships.size() == 0) {
223 return;
224 } else if (PossibleRelationships.size() == 1)
225 SelectedRelationship = PossibleRelationships.at(0);
226 else {
227 QDialog* NewDialog = new QDialog();
228 QHBoxLayout* NewLayout = new QHBoxLayout();
229 QPushButton* OkButton = new QPushButton("Ok");
230 QComboBox* NewCombo = new QComboBox();
231 QLabel* NewLabel = new QLabel("Choose relationship : ");
232 NewCombo->addItems(PossibleRelationships);
233 NewLayout->addWidget(NewLabel);
234 NewLayout->addWidget(NewCombo);
235 NewLayout->addWidget(OkButton);
236 NewDialog->setLayout(NewLayout);
237 NewDialog->adjustSize();
238 connect(OkButton, SIGNAL(clicked()), NewDialog, SLOT(accept()), Qt::UniqueConnection);
239
240 int Status = NewDialog->exec();
241
242 if (Status == QDialog::Accepted) {
243 SelectedRelationship = NewCombo->currentText();
244 }
245 }
246
248
249 if (NodeObject) {
250 for (treenode* Child : NodeObject->GetChildren()) {
251 if (dynamic_cast<RelationshipNode*>(Child)) {
252 RelationshipNode* NodeRelationship = dynamic_cast<RelationshipNode*>(Child);
253 dunedaq::conffwk::relationship_t RelationshipData = NodeRelationship->relation_t();
254
255 if (RelationshipData.p_name == SelectedRelationship.toStdString()) {
256 if ((RelationshipData.p_cardinality == dunedaq::conffwk::zero_or_many) ||
257 (RelationshipData.p_cardinality == dunedaq::conffwk::one_or_many)) {
258 std::vector<std::string> RelationshipValues;
259
260 for (treenode* RelationshipChildren : NodeRelationship->GetChildren())
261 RelationshipValues.push_back(RelationshipChildren->GetData(0).toString().toStdString());
262
263 for (QStringList& Item : NewItems)
264 if (std::find(RelationshipValues.begin(), RelationshipValues.end(), Item.at(0).toStdString()) ==
265 RelationshipValues.end())
266 RelationshipValues.push_back(Item.at(0).toStdString());
267
268 tref Object = NodeObject->GetObject();
269 dbe::config::api::commands::modobj(Object, RelationshipData, RelationshipValues);
270 } else {
271 QString SelectedObject;
272
273 if (NewItems.size() > 1) {
274 QDialog* NewDialog = new QDialog();
275 QHBoxLayout* NewLayout = new QHBoxLayout();
276 QPushButton* OkButton = new QPushButton("Ok");
277 QComboBox* NewCombo = new QComboBox();
278 QLabel* NewLabel = new QLabel("Choose Object : ");
279 NewCombo->addItems(ObjectList);
280 NewLayout->addWidget(NewLabel);
281 NewLayout->addWidget(NewCombo);
282 NewLayout->addWidget(OkButton);
283 NewDialog->setLayout(NewLayout);
284 NewDialog->adjustSize();
285 connect(OkButton, SIGNAL(clicked()), NewDialog, SLOT(accept()), Qt::UniqueConnection);
286
287 int Status = NewDialog->exec();
288
289 if (Status == QDialog::Accepted) {
290 SelectedObject = NewCombo->currentText();
291 }
292 } else {
293 SelectedObject = NewItems.at(0).at(0);
294 }
295
296 tref Object = NodeObject->GetObject();
297 dbe::config::api::commands::modobj(Object, RelationshipData, { SelectedObject.toStdString() });
298 }
299 }
300 }
301 }
302 }
303}
304//------------------------------------------------------------------------------------------
305
306//------------------------------------------------------------------------------------------
307void
309{
310 double dx = 0;
311 double dy = 0;
312
314
315 if (NodeObject) {
316 for (treenode* ChildNode : NodeObject->GetChildren()) {
317 RelationshipNode* NodeRelationship = dynamic_cast<RelationshipNode*>(ChildNode);
318
319 if (NodeRelationship && NodeRelationship->GetHasStructure()) {
320 dunedaq::conffwk::relationship_t RelationshipData = NodeRelationship->relation_t();
321 GraphicalRelationship* RelationshipChildNode =
323 RelationshipChildNode->setParentItem(this);
324 RelationshipChildNode->AddGraphicChildren();
325
326 QPointF coord = RelationshipChildNode->mapFromParent(boundingRect().bottomRight());
327 RelationshipChildNode->setX(coord.x() + dx);
328 RelationshipChildNode->setY(coord.y() + dy);
329
330 for (QGraphicsItem* GraphicItem : RelationshipChildNode->childItems()) {
331 dy += GraphicItem->boundingRect().height();
332 }
333 }
334 }
335 }
336
337 IsFetched = true;
338}
339//------------------------------------------------------------------------------------------
340
341//------------------------------------------------------------------------------------------
342void
344{
345 for (QGraphicsItem* i : this->childItems()) {
346 i->show();
347 }
348
349 double ThisOffsetX = 0;
350 double ThisOffsetY = 0;
351 GetOffsetX(this, ThisOffsetX);
352 GetOffsetY(this, ThisOffsetY);
353 QPointF ThisItemBottom = this->mapToScene(this->boundingRect().bottomRight());
354
355 if (!this->childItems().isEmpty()) {
356 ThisOffsetX -= ThisItemBottom.x();
357 ThisOffsetY -= ThisItemBottom.y();
358 }
359
361 QGraphicsItem* AuxiliaryItem = this;
362
363 while (AuxiliaryItem->parentItem() != nullptr) {
364 for (int i = AuxiliaryItem->parentItem()->childItems().indexOf(AuxiliaryItem) + 1;
365 i < AuxiliaryItem->parentItem()->childItems().size();
366 ++i) {
367 QGraphicsItem* Child = AuxiliaryItem->parentItem()->childItems().at(i);
368 Child->setY(Child->y() + ThisOffsetY);
369 }
370
371 AuxiliaryItem = AuxiliaryItem->parentItem();
372 }
373
376 double ThisTopLevelOffsetX = 0;
377 double ThisTopLevelOffsetY = 0;
378 GetOffsetX(this->topLevelItem(), ThisTopLevelOffsetX);
379 GetOffsetY(this->topLevelItem(), ThisTopLevelOffsetY);
380 QPointF ThisTopLevelItemBottom = this->topLevelItem()->mapToScene(this->topLevelItem()->boundingRect().bottomRight());
381
382 if (!this->topLevelItem()->childItems().isEmpty()) {
383 ThisTopLevelOffsetX -= ThisTopLevelItemBottom.x();
384 ThisTopLevelOffsetY -= ThisTopLevelItemBottom.y();
385 }
386
388 QList<QGraphicsItem*> TopLevelItems = scene()->items();
390 GraphicalObject* ThisTopLevelItem = dynamic_cast<GraphicalObject*>(this->topLevelItem());
391 double LineHighestOffsetY = 0;
392
393 for (QGraphicsItem* Item : TopLevelItems) {
396 if (Item->parentItem() == nullptr && ThisTopLevelItem->y() == Item->y() && ThisTopLevelItem != Item) {
397 GraphicalObject* ItemObject = dynamic_cast<GraphicalObject*>(Item);
398
399 if (ItemObject && LineHighestOffsetY < ItemObject->GetExpandedY())
400 LineHighestOffsetY = ItemObject->GetExpandedY();
401 }
402 }
403
406 for (QGraphicsItem* Item : TopLevelItems) {
407 if (ThisTopLevelItem != Item && Item->parentItem() == nullptr) {
408 if (ThisTopLevelItem->y() < Item->y() && ThisTopLevelOffsetY > LineHighestOffsetY) {
409 if (LineHighestOffsetY == 0) {
410 Item->setY(Item->y() + ThisOffsetY);
411 } else {
412 if (ThisTopLevelOffsetY - LineHighestOffsetY < ThisTopLevelOffsetY - ThisTopLevelItem->GetExpandedY())
413 Item->setY(Item->y() + ThisTopLevelOffsetY - LineHighestOffsetY);
414 else
415 Item->setY(Item->y() + ThisTopLevelOffsetY - ThisTopLevelItem->GetExpandedY());
416 }
417 }
418 }
419
420 if (ThisTopLevelItem->y() == Item->y() && ThisTopLevelItem->x() < Item->x() && Item->parentItem() == nullptr) {
421 if (ThisTopLevelOffsetX > ThisTopLevelItem->GetExpandedX()) {
422 if (ThisTopLevelItem->GetExpandedX() == 0) {
423 Item->setX(Item->x() + ThisOffsetX);
424 } else {
425 Item->setX(Item->x() + ThisTopLevelOffsetX - ThisTopLevelItem->GetExpandedX());
426 }
427 }
428 }
429 }
430
431 ThisTopLevelItem->SetExpandedX(ThisTopLevelOffsetX);
432 ThisTopLevelItem->SetExpandedY(ThisTopLevelOffsetY);
433 IsExpanded = true;
434}
435//------------------------------------------------------------------------------------------
436
437//------------------------------------------------------------------------------------------
438void
440{
441 double ThisOffsetX = 0;
442 double ThisOffsetY = 0;
443 GetOffsetX(this, ThisOffsetX);
444 GetOffsetY(this, ThisOffsetY);
445 QPointF ThisItemBottom = this->mapToScene(this->boundingRect().bottomRight());
446
447 if (!this->childItems().isEmpty()) {
448 ThisOffsetX -= ThisItemBottom.x();
449 ThisOffsetY -= ThisItemBottom.y();
450 }
451
453 QGraphicsItem* AuxiliaryItem = this;
454
455 while (AuxiliaryItem->parentItem() != nullptr) {
456 for (int i = AuxiliaryItem->parentItem()->childItems().indexOf(AuxiliaryItem) + 1;
457 i < AuxiliaryItem->parentItem()->childItems().size();
458 ++i) {
459 QGraphicsItem* Child = AuxiliaryItem->parentItem()->childItems().at(i);
460 Child->setY(Child->y() - ThisOffsetY);
461 }
462
463 AuxiliaryItem = AuxiliaryItem->parentItem();
464 }
465
470 for (QGraphicsItem* i : this->childItems()) {
471 i->hide();
472 }
473
474 double ThisTopLevelOffsetX = 0;
475 double ThisTopLevelOffsetY = 0;
476 GetOffsetX(this->topLevelItem(), ThisTopLevelOffsetX);
477 GetOffsetY(this->topLevelItem(), ThisTopLevelOffsetY);
478 QPointF ThisTopLevelItemBottom = this->topLevelItem()->mapToScene(this->topLevelItem()->boundingRect().bottomRight());
479
480 if (!this->topLevelItem()->childItems().isEmpty() && this->topLevelItem()->childItems().at(0)->isVisible()) {
481 ThisTopLevelOffsetX -= ThisTopLevelItemBottom.x();
482 ThisTopLevelOffsetY -= ThisTopLevelItemBottom.y();
483 }
484
486 QList<QGraphicsItem*> TopLevelItems = scene()->items();
488 GraphicalObject* ThisTopLevelItem = dynamic_cast<GraphicalObject*>(this->topLevelItem());
489 double LineHighestOffsetY = 0;
490
491 for (QGraphicsItem* Item : TopLevelItems) {
494 if (Item->parentItem() == nullptr && ThisTopLevelItem->y() == Item->y() && ThisTopLevelItem != Item) {
495 GraphicalObject* ItemObject = dynamic_cast<GraphicalObject*>(Item);
496
497 if (ItemObject && LineHighestOffsetY < ItemObject->GetExpandedY())
498 LineHighestOffsetY = ItemObject->GetExpandedY();
499 }
500 }
501
504 for (QGraphicsItem* Item : TopLevelItems) {
505 if (ThisTopLevelItem != Item && Item->parentItem() == nullptr) {
506 if (ThisTopLevelItem->y() < Item->y() && ThisTopLevelItem->GetExpandedY() > LineHighestOffsetY) {
507 if (LineHighestOffsetY == 0) {
508 Item->setY(Item->y() - ThisOffsetY);
509 } else {
510 if (ThisTopLevelOffsetY >= LineHighestOffsetY && ThisTopLevelOffsetY < ThisTopLevelItem->GetExpandedY())
511 Item->setY(Item->y() - abs(ThisTopLevelOffsetY - ThisTopLevelItem->GetExpandedY()));
512
513 if (ThisTopLevelItem->GetExpandedY() > LineHighestOffsetY && ThisTopLevelOffsetY < LineHighestOffsetY)
514 Item->setY(Item->y() - abs(ThisTopLevelItem->GetExpandedY() - LineHighestOffsetY));
515 }
516 }
517 }
518
519 if (ThisTopLevelItem->y() == Item->y() && ThisTopLevelItem->x() < Item->x() && Item->parentItem() == nullptr) {
520 if (ThisTopLevelOffsetX < ThisTopLevelItem->GetExpandedX()) {
521 Item->setX(Item->x() - abs(ThisTopLevelOffsetX - ThisTopLevelItem->GetExpandedX()));
522 }
523 }
524 }
525
526 ThisTopLevelItem->SetExpandedX(ThisTopLevelOffsetX);
527 ThisTopLevelItem->SetExpandedY(ThisTopLevelOffsetY);
528 IsExpanded = false;
529}
530//------------------------------------------------------------------------------------------
531
532//------------------------------------------------------------------------------------------
533void
534dbe::GraphicalObject::GetOffsetX(QGraphicsItem* Item, double& Offset)
535{
536 for (QGraphicsItem* ChildItem : Item->childItems()) {
537 if (ChildItem->isVisible()) {
538 QPointF ChildItemBottom = ChildItem->mapToScene(ChildItem->boundingRect().bottomRight());
539
540 if (Offset < ChildItemBottom.x()) {
541 Offset = ChildItemBottom.x();
542 }
543 }
544
545 GetOffsetX(ChildItem, Offset);
546 }
547}
548//------------------------------------------------------------------------------------------
549
550//------------------------------------------------------------------------------------------
551void
552dbe::GraphicalObject::GetOffsetY(QGraphicsItem* Item, double& Offset)
553{
554 for (QGraphicsItem* ChildItem : Item->childItems()) {
555 if (ChildItem->isVisible()) {
556 QPointF ChildItemBottom = ChildItem->mapToScene(ChildItem->boundingRect().bottomRight());
557
558 if (Offset < ChildItemBottom.y()) {
559 Offset = ChildItemBottom.y();
560 }
561 }
562
563 GetOffsetY(ChildItem, Offset);
564 }
565}
566//------------------------------------------------------------------------------------------
567
568//------------------------------------------------------------------------------------------
569void
571{
572 while (Auxiliary->parentItem() != nullptr) {
573 Auxiliary = Auxiliary->parentItem();
574 }
575}
576//------------------------------------------------------------------------------------------
577
578//------------------------------------------------------------------------------------------
579QString
584//------------------------------------------------------------------------------------------
585
586//------------------------------------------------------------------------------------------
587QString
592//------------------------------------------------------------------------------------------
593
594//------------------------------------------------------------------------------------------
595double
597{
598 return expandedX;
599}
600//------------------------------------------------------------------------------------------
601
602//------------------------------------------------------------------------------------------
603double
605{
606 return expandedY;
607}
608//------------------------------------------------------------------------------------------
609
610//------------------------------------------------------------------------------------------
611void
613{
614 expandedX = dx;
615}
616//------------------------------------------------------------------------------------------
617
618//------------------------------------------------------------------------------------------
619void
621{
622 expandedY = dy;
623}
624//------------------------------------------------------------------------------------------
625
626//------------------------------------------------------------------------------------------
628 QString ClassName,
630 QGraphicsObject* parent)
631 : QGraphicsObject(parent)
632 , DatabaseClassName(ClassName)
633 , DatabaseUidName(ObjectName)
634 , RelationshipData(Data)
635 , TextItem(nullptr)
636{
637 TextItem = new QGraphicsTextItem(QString(Data.p_name.c_str()));
638}
639//------------------------------------------------------------------------------------------
640
641//------------------------------------------------------------------------------------------
646//------------------------------------------------------------------------------------------
647
648//------------------------------------------------------------------------------------------
649QRectF
651{
652 return TextItem->boundingRect();
653}
654//------------------------------------------------------------------------------------------
655
656//------------------------------------------------------------------------------------------
657void
658dbe::GraphicalRelationship::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
659{
660 painter->setFont(QFont("Helvetica", 10));
661 TextItem->paint(painter, option, widget);
662}
663//------------------------------------------------------------------------------------------
664
665//------------------------------------------------------------------------------------------
666QPainterPath
668{
669 QPainterPath path;
670 path.addRect(TextItem->boundingRect());
671 return path;
672}
673//------------------------------------------------------------------------------------------
674
675//------------------------------------------------------------------------------------------
676void
678{
679 Q_UNUSED(event)
680}
681//------------------------------------------------------------------------------------------
682
683//------------------------------------------------------------------------------------------
684void
685dbe::GraphicalRelationship::mousePressEvent(QGraphicsSceneMouseEvent* event)
686{
687 Q_UNUSED(event)
688}
689//------------------------------------------------------------------------------------------
690
691//------------------------------------------------------------------------------------------
692void
693dbe::GraphicalRelationship::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
694{
695 Q_UNUSED(event)
696}
697//------------------------------------------------------------------------------------------
698
699//------------------------------------------------------------------------------------------
700void
702{
703 double OffsetY = 0;
704 double OffsetX = 10;
705
707
708 if (NodeObject) {
709 for (treenode* ChildNode : NodeObject->GetChildren()) {
710 if (ChildNode->GetData(0).toString() == QString(RelationshipData.p_name.c_str())) {
711 for (treenode* ChildChildNode : ChildNode->GetChildren()) {
712 ObjectNode* ChildChildNodeObject = dynamic_cast<ObjectNode*>(ChildChildNode);
713
714 if (ChildChildNodeObject) {
715 std::string cname = ChildChildNodeObject->GetObject().class_name();
716 GraphicalClass Dummy = confaccessor::guiconfig()->graphical(cname);
717 GraphicalObject* ObjectNodeGraphical =
718 new GraphicalObject(true, ChildChildNode->GetData(0).toString(), Dummy);
719 ObjectNodeGraphical->setParentItem(this);
720
721 QPointF coord = ObjectNodeGraphical->mapFromParent(boundingRect().topRight());
722 ObjectNodeGraphical->setX(coord.x() + OffsetX);
723 ObjectNodeGraphical->setY(coord.y() + OffsetY);
724 OffsetY += ObjectNodeGraphical->boundingRect().height();
725 }
726 }
727
728 break;
729 }
730 }
731 }
732}
733//------------------------------------------------------------------------------------------
QGraphicsTextItem * TextItem
void AddGraphicChildren()
Graphics.
void GetOffsetY(QGraphicsItem *Item, double &Offset)
void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
double GetExpandedX() const
void GetOffsetX(QGraphicsItem *Item, double &Offset)
Some Api.
GraphicalClass GraphicalInfo
QPainterPath shape() const
double GetExpandedY() const
void mousePressEvent(QGraphicsSceneMouseEvent *event)
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
void dropEvent(QGraphicsSceneDragDropEvent *event)
GraphicalObject(bool Used, QString ObjectName, GraphicalClass GraphInfo, QGraphicsObject *parent=0)
QString GetDatabaseUidName() const
QRectF boundingRect() const
void LocateTopMostItem(QGraphicsItem *Auxiliary)
void SetExpandedX(double dx)
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Event Handler.
QGraphicsPixmapItem * IconItem
void SetExpandedY(double dy)
QString GetDatabaseClassName() const
dunedaq::conffwk::relationship_t RelationshipData
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
QGraphicsTextItem * TextItem
QPainterPath shape() const
void mousePressEvent(QGraphicsSceneMouseEvent *event)
void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
GraphicalRelationship(QString ObjectName, QString ClassName, dunedaq::conffwk::relationship_t &Data, QGraphicsObject *parent=0)
void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Event Handler.
tref GetObject() const
Definition treenode.cpp:276
dunedaq::conffwk::relationship_t relation_t() const
Definition treenode.cpp:384
static cptr< datahandler > gethandler()
static cptr< ui::config::info > guiconfig()
static dunedaq::conffwk::class_t definition(std::string const &cn, bool direct_only)
bool GetHasStructure() const
Definition treenode.cpp:140
virtual tref GetObject() const
Definition treenode.cpp:76
QList< treenode * > GetChildren() const
Definition treenode.cpp:110
void modobj(tref Object, dunedaq::conffwk::attribute_t const &AttributeData, T Value)
inner::configobject::tref tref
Definition tref.hpp:36
const std::vector< relationship_t > p_relationships
Definition Schema.hpp:162
const std::vector< std::string > p_subclasses
Definition Schema.hpp:160