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 50 of file GraphicalClass.hpp.

Constructor & Destructor Documentation

◆ GraphicalObject()

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

Definition at line 22 of file GraphicalClass.cpp.

24 : QGraphicsObject ( parent ),
25 GraphicalInfo ( GraphInfo ),
26 IconItem ( nullptr ),
27 TextItem ( nullptr ),
28 DatabaseClassName ( GraphInfo.DatabaseClassName ),
29 DatabaseUidName ( ObjectName ),
30 IsExpanded ( false ),
31 IsFetched ( false ),
32 expandedX ( 0 ),
33 expandedY ( 0 )
34{
35 setAcceptDrops ( true );
36 setFlag ( ItemIsMovable );
37
38 QPixmap Icon;
39
40 if ( Used )
41 {
42 if ( !GraphInfo.UsedPixmapFile.isEmpty() ) Icon = QPixmap (
43 ":/Images/" + GraphInfo.UsedPixmapFile );
44 else
45 {
46 Icon = QPixmap ( ":/Images/" + GraphInfo.GenericPixmapFile );
47 }
48 }
49 else
50 {
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 348 of file GraphicalClass.cpp.

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

◆ boundingRect()

QRectF dbe::GraphicalObject::boundingRect ( ) const

Definition at line 71 of file GraphicalClass.cpp.

72{
73 QRectF Boundarie;
74 Boundarie.setHeight (
75 IconItem->boundingRect().height() + TextItem->boundingRect().height() );
76
77 if ( IconItem->boundingRect().width() > TextItem->boundingRect().width() ) Boundarie
78 .setWidth ( IconItem->boundingRect().width() );
79 else
80 {
81 Boundarie.setWidth ( TextItem->boundingRect().width() );
82 }
83
84 return Boundarie;
85}

◆ dropEvent()

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

Definition at line 183 of file GraphicalClass.cpp.

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

◆ GetDatabaseClassName()

QString dbe::GraphicalObject::GetDatabaseClassName ( ) const

Definition at line 674 of file GraphicalClass.cpp.

675{
676 return DatabaseClassName;
677}

◆ GetDatabaseUidName()

QString dbe::GraphicalObject::GetDatabaseUidName ( ) const

Definition at line 681 of file GraphicalClass.cpp.

682{
683 return DatabaseUidName;
684}

◆ GetExpandedX()

double dbe::GraphicalObject::GetExpandedX ( ) const

Definition at line 688 of file GraphicalClass.cpp.

689{
690 return expandedX;
691}

◆ GetExpandedY()

double dbe::GraphicalObject::GetExpandedY ( ) const

Definition at line 695 of file GraphicalClass.cpp.

696{
697 return expandedY;
698}

◆ GetOffsetX()

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

Some Api.

Definition at line 622 of file GraphicalClass.cpp.

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

◆ GetOffsetY()

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

Definition at line 643 of file GraphicalClass.cpp.

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

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

665{
666 while ( Auxiliary->parentItem() != nullptr )
667 {
668 Auxiliary = Auxiliary->parentItem();
669 }
670}

◆ mouseDoubleClickEvent()

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

Event Handler.

Definition at line 117 of file GraphicalClass.cpp.

118{
119 if ( !IsFetched )
120 {
122 }
123
124 if ( !IsExpanded )
125 {
127 }
128 else
129 {
131 }
132
133 update();
134 QGraphicsItem::mouseDoubleClickEvent ( event );
135}
void AddGraphicChildren()
Graphics.

◆ mouseMoveEvent()

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

Definition at line 149 of file GraphicalClass.cpp.

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

◆ mousePressEvent()

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

Definition at line 139 of file GraphicalClass.cpp.

140{
141 if ( event->button() == Qt::LeftButton )
142 {
143 StartDrag = event->pos();
144 }
145}

◆ paint()

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

Definition at line 89 of file GraphicalClass.cpp.

92{
93 Q_UNUSED ( option )
94 Q_UNUSED ( widget )
95
96 QFontMetrics Metric ( QFont ( "Helvetica", 10 ) );
97 painter->setFont ( QFont ( "Helvetica", 10 ) );
98 painter->drawPixmap ( IconItem->boundingRect(), IconItem->pixmap(),
99 IconItem->boundingRect() );
100 painter->drawText (
101 IconItem->boundingRect().bottomLeft() + QPointF (
102 0, Metric.boundingRect ( DatabaseUidName ).height() ),
104}

◆ SetExpandedX()

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

Definition at line 702 of file GraphicalClass.cpp.

703{
704 expandedX = dx;
705}

◆ SetExpandedY()

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

Definition at line 709 of file GraphicalClass.cpp.

710{
711 expandedY = dy;
712}

◆ shape()

QPainterPath dbe::GraphicalObject::shape ( ) const

Definition at line 108 of file GraphicalClass.cpp.

109{
110 QPainterPath Path;
111 Path.addRect ( IconItem->boundingRect() );
112 return Path;
113}

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

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

Member Data Documentation

◆ DatabaseClassName

QString dbe::GraphicalObject::DatabaseClassName
private

Definition at line 84 of file GraphicalClass.hpp.

◆ DatabaseUidName

QString dbe::GraphicalObject::DatabaseUidName
private

Definition at line 85 of file GraphicalClass.hpp.

◆ expandedX

double dbe::GraphicalObject::expandedX
private

Definition at line 89 of file GraphicalClass.hpp.

◆ expandedY

double dbe::GraphicalObject::expandedY
private

Definition at line 90 of file GraphicalClass.hpp.

◆ GraphicalInfo

GraphicalClass dbe::GraphicalObject::GraphicalInfo
private

Definition at line 81 of file GraphicalClass.hpp.

◆ IconItem

QGraphicsPixmapItem* dbe::GraphicalObject::IconItem
private

Definition at line 82 of file GraphicalClass.hpp.

◆ IsExpanded

bool dbe::GraphicalObject::IsExpanded
private

Definition at line 86 of file GraphicalClass.hpp.

◆ IsFetched

bool dbe::GraphicalObject::IsFetched
private

Definition at line 87 of file GraphicalClass.hpp.

◆ StartDrag

QPointF dbe::GraphicalObject::StartDrag
private

Definition at line 88 of file GraphicalClass.hpp.

◆ TextItem

QGraphicsTextItem* dbe::GraphicalObject::TextItem
private

Definition at line 83 of file GraphicalClass.hpp.


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