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 55 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.

29 : QGraphicsObject ( parent ),
30 GraphicalInfo ( GraphInfo ),
31 IconItem ( nullptr ),
32 TextItem ( nullptr ),
33 DatabaseClassName ( GraphInfo.DatabaseClassName ),
34 DatabaseUidName ( ObjectName ),
35 IsExpanded ( false ),
36 IsFetched ( false ),
37 expandedX ( 0 ),
38 expandedY ( 0 )
39{
40 setAcceptDrops ( true );
41 setFlag ( ItemIsMovable );
42
43 QPixmap Icon;
44
45 if ( Used )
46 {
47 if ( !GraphInfo.UsedPixmapFile.isEmpty() ) Icon = QPixmap (
48 ":/Images/" + GraphInfo.UsedPixmapFile );
49 else
50 {
51 Icon = QPixmap ( ":/Images/" + GraphInfo.GenericPixmapFile );
52 }
53 }
54 else
55 {
56 Icon = QPixmap ( ":/Images/" + GraphInfo.GenericPixmapFile );
57 }
58
59 QBitmap IconMask = Icon.createHeuristicMask();
60 Icon.setMask ( IconMask );
61
62 IconItem = new QGraphicsPixmapItem ( Icon );
63 TextItem = new QGraphicsTextItem ( ObjectName );
64}
QGraphicsTextItem * TextItem
GraphicalClass GraphicalInfo
QGraphicsPixmapItem * IconItem

◆ ~GraphicalObject()

dbe::GraphicalObject::~GraphicalObject ( )

Definition at line 68 of file GraphicalClass.cpp.

69{
70 delete IconItem;
71 delete TextItem;
72}

Member Function Documentation

◆ AddGraphicChildren()

void dbe::GraphicalObject::AddGraphicChildren ( )

Graphics.

Definition at line 353 of file GraphicalClass.cpp.

354{
355 double dx = 0;
356 double dy = 0;
357
358 treenode * NodeObject = confaccessor::gethandler()->getnode ( DatabaseClassName,
360
361 if ( NodeObject )
362 {
363 for ( treenode * ChildNode : NodeObject->GetChildren() )
364 {
365 RelationshipNode * NodeRelationship = dynamic_cast<RelationshipNode *> ( ChildNode );
366
367 if ( NodeRelationship && NodeRelationship->GetHasStructure() )
368 {
369 dunedaq::conffwk::relationship_t RelationshipData =
370 NodeRelationship->relation_t();
371 GraphicalRelationship * RelationshipChildNode = new GraphicalRelationship (
372 DatabaseUidName, DatabaseClassName, RelationshipData );
373 RelationshipChildNode->setParentItem ( this );
374 RelationshipChildNode->AddGraphicChildren();
375
376 QPointF coord = RelationshipChildNode->mapFromParent ( boundingRect().bottomRight() );
377 RelationshipChildNode->setX ( coord.x() + dx );
378 RelationshipChildNode->setY ( coord.y() + dy );
379
380 for ( QGraphicsItem * GraphicItem : RelationshipChildNode->childItems() )
381 {
382 dy += GraphicItem->boundingRect().height();
383 }
384 }
385 }
386 }
387
388 IsFetched = true;
389}
QRectF boundingRect() const
static cptr< datahandler > gethandler()

◆ boundingRect()

QRectF dbe::GraphicalObject::boundingRect ( ) const

Definition at line 76 of file GraphicalClass.cpp.

77{
78 QRectF Boundarie;
79 Boundarie.setHeight (
80 IconItem->boundingRect().height() + TextItem->boundingRect().height() );
81
82 if ( IconItem->boundingRect().width() > TextItem->boundingRect().width() ) Boundarie
83 .setWidth ( IconItem->boundingRect().width() );
84 else
85 {
86 Boundarie.setWidth ( TextItem->boundingRect().width() );
87 }
88
89 return Boundarie;
90}

◆ dropEvent()

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

Definition at line 188 of file GraphicalClass.cpp.

189{
190 QByteArray encodedData = event->mimeData()->data ( "application/vnd.text.list" );
191 QDataStream stream ( &encodedData, QIODevice::ReadOnly );
192 QList<QStringList> NewItems;
193
194 while ( !stream.atEnd() )
195 {
196 QStringList Text;
197 stream >> Text;
198 NewItems << Text;
199 }
200
201 QStringList ObjectList;
202
203 for ( QStringList & i : NewItems )
204 {
205 ObjectList.append ( i.at ( 0 ) );
206 }
207
208 for ( int i = 0; i < NewItems.size(); ++i )
209 {
210 if ( NewItems.at ( 0 ).at ( 1 ) != NewItems.at ( i ).at ( 1 ) )
211 {
212 return;
213 }
214 }
215
216 QStringList PossibleRelationships;
217 QString ClassName = NewItems.at ( 0 ).at ( 1 );
218
219 dunedaq::conffwk::class_t ClassInfoReceiverObject =
221 std::vector<dunedaq::conffwk::relationship_t> RelationshipList = ClassInfoReceiverObject
223
224 for ( dunedaq::conffwk::relationship_t & i : RelationshipList )
225 {
226 if ( i.p_type == ClassName.toStdString() ) PossibleRelationships.append (
227 QString::fromStdString ( i.p_name ) );
228
229 dunedaq::conffwk::class_t ClassInfoDroppedObject =
231 false );
232 std::vector<std::string> RelationshipListDropped = ClassInfoDroppedObject.p_subclasses;
233
234 for ( std::string & j : RelationshipListDropped )
235 {
236 if ( j == ClassName.toStdString() ) PossibleRelationships.append (
237 QString::fromStdString ( i.p_name ) );
238 }
239 }
240
241 QString SelectedRelationship;
242
243 if ( PossibleRelationships.size() == 0 )
244 {
245 return;
246 }
247 else if ( PossibleRelationships.size() == 1 ) SelectedRelationship = PossibleRelationships
248 .at ( 0 );
249 else
250 {
251 QDialog * NewDialog = new QDialog();
252 QHBoxLayout * NewLayout = new QHBoxLayout();
253 QPushButton * OkButton = new QPushButton ( "Ok" );
254 QComboBox * NewCombo = new QComboBox();
255 QLabel * NewLabel = new QLabel ( "Choose relationship : " );
256 NewCombo->addItems ( PossibleRelationships );
257 NewLayout->addWidget ( NewLabel );
258 NewLayout->addWidget ( NewCombo );
259 NewLayout->addWidget ( OkButton );
260 NewDialog->setLayout ( NewLayout );
261 NewDialog->adjustSize();
262 connect ( OkButton, SIGNAL ( clicked() ), NewDialog, SLOT ( accept() ),
263 Qt::UniqueConnection );
264
265 int Status = NewDialog->exec();
266
267 if ( Status == QDialog::Accepted )
268 {
269 SelectedRelationship = NewCombo->currentText();
270 }
271 }
272
273 treenode * NodeObject = confaccessor::gethandler()->getnode ( DatabaseClassName,
275
276 if ( NodeObject )
277 {
278 for ( treenode * Child : NodeObject->GetChildren() )
279 {
280 if ( dynamic_cast<RelationshipNode *> ( Child ) )
281 {
282 RelationshipNode * NodeRelationship = dynamic_cast<RelationshipNode *> ( Child );
283 dunedaq::conffwk::relationship_t RelationshipData =
284 NodeRelationship->relation_t();
285
286 if ( RelationshipData.p_name == SelectedRelationship.toStdString() )
287 {
288 if ( ( RelationshipData.p_cardinality == dunedaq::conffwk::zero_or_many ) || ( RelationshipData
291 {
292 std::vector<std::string> RelationshipValues;
293
294 for ( treenode * RelationshipChildren : NodeRelationship->GetChildren() )
295 RelationshipValues.push_back (
296 RelationshipChildren->GetData ( 0 ).toString().toStdString() );
297
298 for ( QStringList & Item : NewItems )
299 if ( std::find ( RelationshipValues.begin(), RelationshipValues.end(),
300 Item.at ( 0 ).toStdString() )
301 == RelationshipValues.end() ) RelationshipValues.push_back (
302 Item.at ( 0 ).toStdString() );
303
304 tref Object = NodeObject->GetObject();
305 dbe::config::api::commands::modobj ( Object, RelationshipData,
306 RelationshipValues );
307 }
308 else
309 {
310 QString SelectedObject;
311
312 if ( NewItems.size() > 1 )
313 {
314 QDialog * NewDialog = new QDialog();
315 QHBoxLayout * NewLayout = new QHBoxLayout();
316 QPushButton * OkButton = new QPushButton ( "Ok" );
317 QComboBox * NewCombo = new QComboBox();
318 QLabel * NewLabel = new QLabel ( "Choose Object : " );
319 NewCombo->addItems ( ObjectList );
320 NewLayout->addWidget ( NewLabel );
321 NewLayout->addWidget ( NewCombo );
322 NewLayout->addWidget ( OkButton );
323 NewDialog->setLayout ( NewLayout );
324 NewDialog->adjustSize();
325 connect ( OkButton, SIGNAL ( clicked() ), NewDialog, SLOT ( accept() ),
326 Qt::UniqueConnection );
327
328 int Status = NewDialog->exec();
329
330 if ( Status == QDialog::Accepted )
331 {
332 SelectedObject = NewCombo->currentText();
333 }
334 }
335 else
336 {
337 SelectedObject = NewItems.at ( 0 ).at ( 0 );
338 }
339
340 tref Object = NodeObject->GetObject();
341 dbe::config::api::commands::modobj ( Object, RelationshipData,
342 { SelectedObject.toStdString() } );
343
344 }
345 }
346 }
347 }
348 }
349}
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:35
const std::vector< relationship_t > p_relationships
Definition Schema.hpp:171
const std::vector< std::string > p_subclasses
Definition Schema.hpp:169

◆ GetDatabaseClassName()

QString dbe::GraphicalObject::GetDatabaseClassName ( ) const

Definition at line 679 of file GraphicalClass.cpp.

680{
681 return DatabaseClassName;
682}

◆ GetDatabaseUidName()

QString dbe::GraphicalObject::GetDatabaseUidName ( ) const

Definition at line 686 of file GraphicalClass.cpp.

687{
688 return DatabaseUidName;
689}

◆ GetExpandedX()

double dbe::GraphicalObject::GetExpandedX ( ) const

Definition at line 693 of file GraphicalClass.cpp.

694{
695 return expandedX;
696}

◆ GetExpandedY()

double dbe::GraphicalObject::GetExpandedY ( ) const

Definition at line 700 of file GraphicalClass.cpp.

701{
702 return expandedY;
703}

◆ GetOffsetX()

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

Some Api.

Definition at line 627 of file GraphicalClass.cpp.

628{
629 for ( QGraphicsItem * ChildItem : Item->childItems() )
630 {
631 if ( ChildItem->isVisible() )
632 {
633 QPointF ChildItemBottom = ChildItem->mapToScene (
634 ChildItem->boundingRect().bottomRight() );
635
636 if ( Offset < ChildItemBottom.x() )
637 {
638 Offset = ChildItemBottom.x();
639 }
640 }
641
642 GetOffsetX ( ChildItem, Offset );
643 }
644}
void GetOffsetX(QGraphicsItem *Item, double &Offset)
Some Api.

◆ GetOffsetY()

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

Definition at line 648 of file GraphicalClass.cpp.

649{
650 for ( QGraphicsItem * ChildItem : Item->childItems() )
651 {
652 if ( ChildItem->isVisible() )
653 {
654 QPointF ChildItemBottom = ChildItem->mapToScene (
655 ChildItem->boundingRect().bottomRight() );
656
657 if ( Offset < ChildItemBottom.y() )
658 {
659 Offset = ChildItemBottom.y();
660 }
661 }
662
663 GetOffsetY ( ChildItem, Offset );
664 }
665}
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 510 of file GraphicalClass.cpp.

511{
512 double ThisOffsetX = 0;
513 double ThisOffsetY = 0;
514 GetOffsetX ( this, ThisOffsetX );
515 GetOffsetY ( this, ThisOffsetY );
516 QPointF ThisItemBottom = this->mapToScene ( this->boundingRect().bottomRight() );
517
518 if ( !this->childItems().isEmpty() )
519 {
520 ThisOffsetX -= ThisItemBottom.x();
521 ThisOffsetY -= ThisItemBottom.y();
522 }
523
525 QGraphicsItem * AuxiliaryItem = this;
526
527 while ( AuxiliaryItem->parentItem() != nullptr )
528 {
529 for ( int i = AuxiliaryItem->parentItem()->childItems().indexOf ( AuxiliaryItem ) + 1;
530 i < AuxiliaryItem->parentItem()->childItems().size(); ++i )
531 {
532 QGraphicsItem * Child = AuxiliaryItem->parentItem()->childItems().at ( i );
533 Child->setY ( Child->y() - ThisOffsetY );
534 }
535
536 AuxiliaryItem = AuxiliaryItem->parentItem();
537 }
538
543 for ( QGraphicsItem * i : this->childItems() )
544 {
545 i->hide();
546 }
547
548 double ThisTopLevelOffsetX = 0;
549 double ThisTopLevelOffsetY = 0;
550 GetOffsetX ( this->topLevelItem(), ThisTopLevelOffsetX );
551 GetOffsetY ( this->topLevelItem(), ThisTopLevelOffsetY );
552 QPointF ThisTopLevelItemBottom = this->topLevelItem()->mapToScene (
553 this->topLevelItem()->boundingRect().bottomRight() );
554
555 if ( !this->topLevelItem()->childItems().isEmpty()
556 && this->topLevelItem()->childItems().at (
557 0 )->isVisible() )
558 {
559 ThisTopLevelOffsetX -= ThisTopLevelItemBottom.x();
560 ThisTopLevelOffsetY -= ThisTopLevelItemBottom.y();
561 }
562
564 QList<QGraphicsItem *> TopLevelItems = scene()->items();
566 GraphicalObject * ThisTopLevelItem = dynamic_cast<GraphicalObject *>
567 ( this->topLevelItem() );
568 double LineHighestOffsetY = 0;
569
570 for ( QGraphicsItem * Item : TopLevelItems )
571 {
574 if ( Item->parentItem() == nullptr && ThisTopLevelItem->y() == Item->y()
575 && ThisTopLevelItem != Item )
576 {
577 GraphicalObject * ItemObject = dynamic_cast<GraphicalObject *> ( Item );
578
579 if ( ItemObject && LineHighestOffsetY < ItemObject->GetExpandedY() ) LineHighestOffsetY =
580 ItemObject->GetExpandedY();
581 }
582 }
583
586 for ( QGraphicsItem * Item : TopLevelItems )
587 {
588 if ( ThisTopLevelItem != Item && Item->parentItem() == nullptr )
589 {
590 if ( ThisTopLevelItem->y() < Item->y() && ThisTopLevelItem->GetExpandedY()
591 > LineHighestOffsetY )
592 {
593 if ( LineHighestOffsetY == 0 )
594 {
595 Item->setY ( Item->y() - ThisOffsetY );
596 }
597 else
598 {
599 if ( ThisTopLevelOffsetY >= LineHighestOffsetY && ThisTopLevelOffsetY
600 < ThisTopLevelItem->GetExpandedY() ) Item->setY (
601 Item->y() - abs ( ThisTopLevelOffsetY - ThisTopLevelItem->GetExpandedY() ) );
602
603 if ( ThisTopLevelItem->GetExpandedY() > LineHighestOffsetY && ThisTopLevelOffsetY
604 < LineHighestOffsetY ) Item->setY (
605 Item->y() - abs ( ThisTopLevelItem->GetExpandedY() - LineHighestOffsetY ) );
606 }
607 }
608 }
609
610 if ( ThisTopLevelItem->y() == Item->y() && ThisTopLevelItem->x() < Item->x()
611 && Item->parentItem() == nullptr )
612 {
613 if ( ThisTopLevelOffsetX < ThisTopLevelItem->GetExpandedX() )
614 {
615 Item->setX ( Item->x() - abs ( ThisTopLevelOffsetX - ThisTopLevelItem->GetExpandedX() ) );
616 }
617 }
618 }
619
620 ThisTopLevelItem->SetExpandedX ( ThisTopLevelOffsetX );
621 ThisTopLevelItem->SetExpandedY ( ThisTopLevelOffsetY );
622 IsExpanded = false;
623}
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 669 of file GraphicalClass.cpp.

670{
671 while ( Auxiliary->parentItem() != nullptr )
672 {
673 Auxiliary = Auxiliary->parentItem();
674 }
675}

◆ mouseDoubleClickEvent()

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

Event Handler.

Definition at line 122 of file GraphicalClass.cpp.

123{
124 if ( !IsFetched )
125 {
127 }
128
129 if ( !IsExpanded )
130 {
132 }
133 else
134 {
136 }
137
138 update();
139 QGraphicsItem::mouseDoubleClickEvent ( event );
140}
void AddGraphicChildren()
Graphics.

◆ mouseMoveEvent()

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

Definition at line 154 of file GraphicalClass.cpp.

155{
156 if ( ! ( event->buttons() & Qt::LeftButton ) )
157 {
158 return;
159 }
160
161 if ( ( event->pos() - StartDrag ).manhattanLength() < QApplication::startDragDistance() )
162 {
163 return;
164 }
165
166 QDrag * drag = new QDrag ( event->widget() );
167 QPixmap Icon = IconItem->pixmap();
168
169 QStringList DataList;
170 QMimeData * mimeData = new QMimeData;
171 QByteArray ItemData;
172 QDataStream DataStream ( &ItemData, QIODevice::WriteOnly );
173
174 DataList.append ( QString ( DatabaseUidName ) );
175 DataList.append ( QString ( DatabaseClassName ) );
176 DataStream << DataList;
177 mimeData->setData ( "application/vnd.text.list", ItemData );
178
179 drag->setMimeData ( mimeData );
180 drag->setPixmap ( Icon );
181
182 Qt::DropAction dropAction = drag->exec();
183 Q_UNUSED ( dropAction )
184}

◆ mousePressEvent()

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

Definition at line 144 of file GraphicalClass.cpp.

145{
146 if ( event->button() == Qt::LeftButton )
147 {
148 StartDrag = event->pos();
149 }
150}

◆ paint()

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

Definition at line 94 of file GraphicalClass.cpp.

97{
98 Q_UNUSED ( option )
99 Q_UNUSED ( widget )
100
101 QFontMetrics Metric ( QFont ( "Helvetica", 10 ) );
102 painter->setFont ( QFont ( "Helvetica", 10 ) );
103 painter->drawPixmap ( IconItem->boundingRect(), IconItem->pixmap(),
104 IconItem->boundingRect() );
105 painter->drawText (
106 IconItem->boundingRect().bottomLeft() + QPointF (
107 0, Metric.boundingRect ( DatabaseUidName ).height() ),
109}

◆ SetExpandedX()

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

Definition at line 707 of file GraphicalClass.cpp.

708{
709 expandedX = dx;
710}

◆ SetExpandedY()

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

Definition at line 714 of file GraphicalClass.cpp.

715{
716 expandedY = dy;
717}

◆ shape()

QPainterPath dbe::GraphicalObject::shape ( ) const

Definition at line 113 of file GraphicalClass.cpp.

114{
115 QPainterPath Path;
116 Path.addRect ( IconItem->boundingRect() );
117 return Path;
118}

◆ 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 393 of file GraphicalClass.cpp.

394{
395 for ( QGraphicsItem * i : this->childItems() )
396 {
397 i->show();
398 }
399
400 double ThisOffsetX = 0;
401 double ThisOffsetY = 0;
402 GetOffsetX ( this, ThisOffsetX );
403 GetOffsetY ( this, ThisOffsetY );
404 QPointF ThisItemBottom = this->mapToScene ( this->boundingRect().bottomRight() );
405
406 if ( !this->childItems().isEmpty() )
407 {
408 ThisOffsetX -= ThisItemBottom.x();
409 ThisOffsetY -= ThisItemBottom.y();
410 }
411
413 QGraphicsItem * AuxiliaryItem = this;
414
415 while ( AuxiliaryItem->parentItem() != nullptr )
416 {
417 for ( int i = AuxiliaryItem->parentItem()->childItems().indexOf ( AuxiliaryItem ) + 1;
418 i < AuxiliaryItem->parentItem()->childItems().size(); ++i )
419 {
420 QGraphicsItem * Child = AuxiliaryItem->parentItem()->childItems().at ( i );
421 Child->setY ( Child->y() + ThisOffsetY );
422 }
423
424 AuxiliaryItem = AuxiliaryItem->parentItem();
425 }
426
429 double ThisTopLevelOffsetX = 0;
430 double ThisTopLevelOffsetY = 0;
431 GetOffsetX ( this->topLevelItem(), ThisTopLevelOffsetX );
432 GetOffsetY ( this->topLevelItem(), ThisTopLevelOffsetY );
433 QPointF ThisTopLevelItemBottom = this->topLevelItem()->mapToScene (
434 this->topLevelItem()->boundingRect().bottomRight() );
435
436 if ( !this->topLevelItem()->childItems().isEmpty() )
437 {
438 ThisTopLevelOffsetX -= ThisTopLevelItemBottom.x();
439 ThisTopLevelOffsetY -= ThisTopLevelItemBottom.y();
440 }
441
443 QList<QGraphicsItem *> TopLevelItems = scene()->items();
445 GraphicalObject * ThisTopLevelItem = dynamic_cast<GraphicalObject *>
446 ( this->topLevelItem() );
447 double LineHighestOffsetY = 0;
448
449 for ( QGraphicsItem * Item : TopLevelItems )
450 {
453 if ( Item->parentItem() == nullptr && ThisTopLevelItem->y() == Item->y()
454 && ThisTopLevelItem != Item )
455 {
456 GraphicalObject * ItemObject = dynamic_cast<GraphicalObject *> ( Item );
457
458 if ( ItemObject && LineHighestOffsetY < ItemObject->GetExpandedY() ) LineHighestOffsetY =
459 ItemObject->GetExpandedY();
460 }
461 }
462
465 for ( QGraphicsItem * Item : TopLevelItems )
466 {
467 if ( ThisTopLevelItem != Item && Item->parentItem() == nullptr )
468 {
469 if ( ThisTopLevelItem->y() < Item->y() && ThisTopLevelOffsetY > LineHighestOffsetY )
470 {
471 if ( LineHighestOffsetY == 0 )
472 {
473 Item->setY ( Item->y() + ThisOffsetY );
474 }
475 else
476 {
477 if ( ThisTopLevelOffsetY - LineHighestOffsetY < ThisTopLevelOffsetY
478 - ThisTopLevelItem->GetExpandedY() ) Item->setY (
479 Item->y() + ThisTopLevelOffsetY - LineHighestOffsetY );
480 else Item->setY (
481 Item->y() + ThisTopLevelOffsetY - ThisTopLevelItem->GetExpandedY() );
482 }
483 }
484 }
485
486 if ( ThisTopLevelItem->y() == Item->y() && ThisTopLevelItem->x() < Item->x()
487 && Item->parentItem() == nullptr )
488 {
489 if ( ThisTopLevelOffsetX > ThisTopLevelItem->GetExpandedX() )
490 {
491 if ( ThisTopLevelItem->GetExpandedX() == 0 )
492 {
493 Item->setX ( Item->x() + ThisOffsetX );
494 }
495 else
496 {
497 Item->setX ( Item->x() + ThisTopLevelOffsetX - ThisTopLevelItem->GetExpandedX() );
498 }
499 }
500 }
501 }
502
503 ThisTopLevelItem->SetExpandedX ( ThisTopLevelOffsetX );
504 ThisTopLevelItem->SetExpandedY ( ThisTopLevelOffsetY );
505 IsExpanded = true;
506}

Member Data Documentation

◆ DatabaseClassName

QString dbe::GraphicalObject::DatabaseClassName
private

Definition at line 89 of file GraphicalClass.hpp.

◆ DatabaseUidName

QString dbe::GraphicalObject::DatabaseUidName
private

Definition at line 90 of file GraphicalClass.hpp.

◆ expandedX

double dbe::GraphicalObject::expandedX
private

Definition at line 94 of file GraphicalClass.hpp.

◆ expandedY

double dbe::GraphicalObject::expandedY
private

Definition at line 95 of file GraphicalClass.hpp.

◆ GraphicalInfo

GraphicalClass dbe::GraphicalObject::GraphicalInfo
private

Definition at line 86 of file GraphicalClass.hpp.

◆ IconItem

QGraphicsPixmapItem* dbe::GraphicalObject::IconItem
private

Definition at line 87 of file GraphicalClass.hpp.

◆ IsExpanded

bool dbe::GraphicalObject::IsExpanded
private

Definition at line 91 of file GraphicalClass.hpp.

◆ IsFetched

bool dbe::GraphicalObject::IsFetched
private

Definition at line 92 of file GraphicalClass.hpp.

◆ StartDrag

QPointF dbe::GraphicalObject::StartDrag
private

Definition at line 93 of file GraphicalClass.hpp.

◆ TextItem

QGraphicsTextItem* dbe::GraphicalObject::TextItem
private

Definition at line 88 of file GraphicalClass.hpp.


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