DUNE-DAQ
DUNE Trigger and Data Acquisition software
Loading...
Searching...
No Matches
dbe::GraphicalObject Class Reference

#include <GraphicalClass.hpp>

Inheritance diagram for dbe::GraphicalObject:
[legend]
Collaboration diagram for dbe::GraphicalObject:
[legend]

Public Member Functions

 GraphicalObject (bool Used, QString ObjectName, GraphicalClass GraphInfo, QGraphicsObject *parent=0)
 ~GraphicalObject ()
QRectF boundingRect () const
void paint (QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
QPainterPath shape () const
void mouseDoubleClickEvent (QGraphicsSceneMouseEvent *event)
 Event Handler.
void mousePressEvent (QGraphicsSceneMouseEvent *event)
void mouseMoveEvent (QGraphicsSceneMouseEvent *event)
void dropEvent (QGraphicsSceneDragDropEvent *event)
void AddGraphicChildren ()
 Graphics.
void ShowGraphicsChildren ()
void HideGraphicsChildren ()
double GetExpandedX () const
double GetExpandedY () const
void SetExpandedX (double dx)
void SetExpandedY (double dy)
void GetOffsetX (QGraphicsItem *Item, double &Offset)
 Some Api.
void GetOffsetY (QGraphicsItem *Item, double &Offset)
void LocateTopMostItem (QGraphicsItem *Auxiliary)
QString GetDatabaseClassName () const
QString GetDatabaseUidName () const

Private Attributes

GraphicalClass GraphicalInfo
QGraphicsPixmapItem * IconItem
QGraphicsTextItem * TextItem
QString DatabaseClassName
QString DatabaseUidName
bool IsExpanded
bool IsFetched
QPointF StartDrag
double expandedX
double expandedY

Detailed Description

Definition at line 54 of file GraphicalClass.hpp.

Constructor & Destructor Documentation

◆ GraphicalObject()

dbe::GraphicalObject::GraphicalObject ( bool Used,
QString ObjectName,
GraphicalClass GraphInfo,
QGraphicsObject * parent = 0 )
explicit

Definition at line 27 of file GraphicalClass.cpp.

28 : QGraphicsObject(parent)
29 , GraphicalInfo(GraphInfo)
30 , IconItem(nullptr)
31 , TextItem(nullptr)
32 , DatabaseClassName(GraphInfo.DatabaseClassName)
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}
QGraphicsTextItem * TextItem
GraphicalClass GraphicalInfo
QGraphicsPixmapItem * IconItem

◆ ~GraphicalObject()

dbe::GraphicalObject::~GraphicalObject ( )

Definition at line 63 of file GraphicalClass.cpp.

64{
65 delete IconItem;
66 delete TextItem;
67}

Member Function Documentation

◆ AddGraphicChildren()

void dbe::GraphicalObject::AddGraphicChildren ( )

Graphics.

Definition at line 308 of file GraphicalClass.cpp.

309{
310 double dx = 0;
311 double dy = 0;
312
313 treenode* NodeObject = confaccessor::gethandler()->getnode(DatabaseClassName, DatabaseUidName);
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}
QRectF boundingRect() const
GraphicalRelationship(QString ObjectName, QString ClassName, dunedaq::conffwk::relationship_t &Data, QGraphicsObject *parent=0)
static cptr< datahandler > gethandler()

◆ boundingRect()

QRectF dbe::GraphicalObject::boundingRect ( ) const

Definition at line 72 of file GraphicalClass.cpp.

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}

◆ dropEvent()

void dbe::GraphicalObject::dropEvent ( QGraphicsSceneDragDropEvent * event)

Definition at line 176 of file GraphicalClass.cpp.

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
247 treenode* NodeObject = confaccessor::gethandler()->getnode(DatabaseClassName, DatabaseUidName);
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}
static dunedaq::conffwk::class_t definition(std::string const &cn, bool direct_only)
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

◆ GetDatabaseClassName()

QString dbe::GraphicalObject::GetDatabaseClassName ( ) const

Definition at line 580 of file GraphicalClass.cpp.

581{
582 return DatabaseClassName;
583}

◆ GetDatabaseUidName()

QString dbe::GraphicalObject::GetDatabaseUidName ( ) const

Definition at line 588 of file GraphicalClass.cpp.

589{
590 return DatabaseUidName;
591}

◆ GetExpandedX()

double dbe::GraphicalObject::GetExpandedX ( ) const

Definition at line 596 of file GraphicalClass.cpp.

597{
598 return expandedX;
599}

◆ GetExpandedY()

double dbe::GraphicalObject::GetExpandedY ( ) const

Definition at line 604 of file GraphicalClass.cpp.

605{
606 return expandedY;
607}

◆ GetOffsetX()

void dbe::GraphicalObject::GetOffsetX ( QGraphicsItem * Item,
double & Offset )

Some Api.

Definition at line 534 of file GraphicalClass.cpp.

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}
void GetOffsetX(QGraphicsItem *Item, double &Offset)
Some Api.

◆ GetOffsetY()

void dbe::GraphicalObject::GetOffsetY ( QGraphicsItem * Item,
double & Offset )

Definition at line 552 of file GraphicalClass.cpp.

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}
void GetOffsetY(QGraphicsItem *Item, double &Offset)

◆ HideGraphicsChildren()

void dbe::GraphicalObject::HideGraphicsChildren ( )

First change items with the same parent

Now that the items with the same parent are in their final position calculate the OffsetX/OffsetY of this item top level parent item THIS FOR IS EXTREMELY IMPORTANT -> DO NOT TOUCH IT IF YOU TOUCH IT I WILL HUNT YOU FOREVER....AND ONE DAY I WILL CATCH YOU

Now get all the items in the scene

Now get the highest y in the same line as this top level item

Get only top levels items at the same line as this top level item and not equal as this top level item

Now i have the highest offset on the line, distance from the line bottom line Iterating over the top level items to add proper offsetX/offsetY

Definition at line 439 of file GraphicalClass.cpp.

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}
double GetExpandedX() const
double GetExpandedY() const
GraphicalObject(bool Used, QString ObjectName, GraphicalClass GraphInfo, QGraphicsObject *parent=0)
FELIX Initialization std::string initerror FELIX queue timed std::string queuename Unexpected chunk size

◆ LocateTopMostItem()

void dbe::GraphicalObject::LocateTopMostItem ( QGraphicsItem * Auxiliary)

Definition at line 570 of file GraphicalClass.cpp.

571{
572 while (Auxiliary->parentItem() != nullptr) {
573 Auxiliary = Auxiliary->parentItem();
574 }
575}

◆ mouseDoubleClickEvent()

void dbe::GraphicalObject::mouseDoubleClickEvent ( QGraphicsSceneMouseEvent * event)

Event Handler.

Definition at line 114 of file GraphicalClass.cpp.

115{
116 if (!IsFetched) {
118 }
119
120 if (!IsExpanded) {
122 } else {
124 }
125
126 update();
127 QGraphicsItem::mouseDoubleClickEvent(event);
128}
void AddGraphicChildren()
Graphics.

◆ mouseMoveEvent()

void dbe::GraphicalObject::mouseMoveEvent ( QGraphicsSceneMouseEvent * event)

Definition at line 143 of file GraphicalClass.cpp.

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}

◆ mousePressEvent()

void dbe::GraphicalObject::mousePressEvent ( QGraphicsSceneMouseEvent * event)

Definition at line 133 of file GraphicalClass.cpp.

134{
135 if (event->button() == Qt::LeftButton) {
136 StartDrag = event->pos();
137 }
138}

◆ paint()

void dbe::GraphicalObject::paint ( QPainter * painter,
const QStyleOptionGraphicsItem * option,
QWidget * widget )

Definition at line 89 of file GraphicalClass.cpp.

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}

◆ SetExpandedX()

void dbe::GraphicalObject::SetExpandedX ( double dx)

Definition at line 612 of file GraphicalClass.cpp.

613{
614 expandedX = dx;
615}

◆ SetExpandedY()

void dbe::GraphicalObject::SetExpandedY ( double dy)

Definition at line 620 of file GraphicalClass.cpp.

621{
622 expandedY = dy;
623}

◆ shape()

QPainterPath dbe::GraphicalObject::shape ( ) const

Definition at line 104 of file GraphicalClass.cpp.

105{
106 QPainterPath Path;
107 Path.addRect(IconItem->boundingRect());
108 return Path;
109}

◆ ShowGraphicsChildren()

void dbe::GraphicalObject::ShowGraphicsChildren ( )

First change items with the same parent

Now that the items with the same parent are in their final position calculate the OffsetX/OffsetY of this item top level parent item

Now get all the items in the scene

Now get the highest y in the same line as this top level item

Get only top levels items at the same line as this top level item and not equal as this top level item

Now i have the highest offset on the line, distance from the line bottom line Iterating over the top level items to add proper offsetX/offsetY

Definition at line 343 of file GraphicalClass.cpp.

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}

Member Data Documentation

◆ DatabaseClassName

QString dbe::GraphicalObject::DatabaseClassName
private

Definition at line 87 of file GraphicalClass.hpp.

◆ DatabaseUidName

QString dbe::GraphicalObject::DatabaseUidName
private

Definition at line 88 of file GraphicalClass.hpp.

◆ expandedX

double dbe::GraphicalObject::expandedX
private

Definition at line 92 of file GraphicalClass.hpp.

◆ expandedY

double dbe::GraphicalObject::expandedY
private

Definition at line 93 of file GraphicalClass.hpp.

◆ GraphicalInfo

GraphicalClass dbe::GraphicalObject::GraphicalInfo
private

Definition at line 84 of file GraphicalClass.hpp.

◆ IconItem

QGraphicsPixmapItem* dbe::GraphicalObject::IconItem
private

Definition at line 85 of file GraphicalClass.hpp.

◆ IsExpanded

bool dbe::GraphicalObject::IsExpanded
private

Definition at line 89 of file GraphicalClass.hpp.

◆ IsFetched

bool dbe::GraphicalObject::IsFetched
private

Definition at line 90 of file GraphicalClass.hpp.

◆ StartDrag

QPointF dbe::GraphicalObject::StartDrag
private

Definition at line 91 of file GraphicalClass.hpp.

◆ TextItem

QGraphicsTextItem* dbe::GraphicalObject::TextItem
private

Definition at line 86 of file GraphicalClass.hpp.


The documentation for this class was generated from the following files: