30 #include "../../core/pattern/mvc/ItemObserver.h" 
   36 #include <QGraphicsScene> 
   37 #include <QGraphicsItem> 
   53   if (m_scene->selectedItems().isEmpty())
 
   56   QGraphicsItem* selectedItem = m_scene->selectedItems().first();
 
   57   QList<QGraphicsItem *> overlapItems = selectedItem->collidingItems();
 
   59   qreal maxZValue = selectedItem->zValue();
 
   60   QGraphicsItem* itemMaxZValue = selectedItem;
 
   62   qreal zValue = selectedItem->zValue();
 
   63   foreach (QGraphicsItem *item, overlapItems) 
 
   72           maxZValue = item->zValue();
 
   78   selectedItem->setZValue(maxZValue);
 
   81     itemMaxZValue->setZValue(zValue);
 
   87   if (m_scene->selectedItems().isEmpty())
 
   90   QGraphicsItem *selectedItem = m_scene->selectedItems().first();
 
   91   QList<QGraphicsItem *> overlapItems = selectedItem->collidingItems();
 
   93   qreal minimumZValue = selectedItem->zValue();
 
   94   QGraphicsItem* itemMinimumZValue = selectedItem;
 
   96   qreal zValue = selectedItem->zValue();
 
   97   foreach (QGraphicsItem *item, overlapItems) 
 
  106           minimumZValue = item->zValue();
 
  107           itemMinimumZValue = item;
 
  112   selectedItem->setZValue(minimumZValue);
 
  113   if(itemMinimumZValue)
 
  115     itemMinimumZValue->setZValue(zValue);
 
  121   QRectF sourceRect = getSelectionItemsBoundingBox();
 
  123   if(!sourceRect.isValid())
 
  126   QList<QGraphicsItem *> items = m_scene->selectedItems(); 
 
  132   m_config->getPaperSize(ww, hh);
 
  134   if(items.count() == 1)
 
  138     QPointF pot(dbLeft, items.first()->sceneBoundingRect().y());   
 
  139     items.first()->setPos(pot);
 
  143   dbLeft = sourceRect.left();
 
  145   foreach (QGraphicsItem *item, items) 
 
  149       QPointF pt(dbLeft, item->scenePos().y());
 
  157   QRectF sourceRect = getSelectionItemsBoundingBox();
 
  159   if(!sourceRect.isValid())
 
  162   QList<QGraphicsItem *> items = m_scene->selectedItems(); 
 
  170   m_config->getPaperSize(ww, hh);
 
  172   if(items.count() == 1)
 
  176     w = dbRight - items.first()->sceneBoundingRect().width();
 
  177     QPointF pot(w, items.first()->sceneBoundingRect().y());
 
  178     items.first()->setPos(pot);
 
  182   dbRight = sourceRect.right();
 
  184   foreach (QGraphicsItem *item, items) 
 
  188       w = dbRight - item->sceneBoundingRect().width();
 
  189       QPointF pt(w, item->scenePos().y());
 
  197   QRectF sourceRect = getSelectionItemsBoundingBox();
 
  199   if(!sourceRect.isValid())
 
  202   QList<QGraphicsItem *> items = m_scene->selectedItems(); 
 
  209   m_config->getPaperSize(ww, hh);
 
  211   if(items.count() == 1)
 
  215     h = dbBottom - items.first()->sceneBoundingRect().height();
 
  216     QPointF pot(items.first()->sceneBoundingRect().x(), h);
 
  217     items.first()->setPos(pot);
 
  221   dbBottom = sourceRect.bottom();
 
  223   foreach (QGraphicsItem *item, items) 
 
  227       h = dbBottom - item->sceneBoundingRect().height();
 
  228       QPointF pt(item->scenePos().x(), h);
 
  236   QRectF sourceRect = getSelectionItemsBoundingBox();
 
  238   if(!sourceRect.isValid())
 
  241   QList<QGraphicsItem *> items = m_scene->selectedItems(); 
 
  247   m_config->getPaperSize(ww, hh);
 
  249   if(items.count() == 1)
 
  253     QPointF pot(items.first()->sceneBoundingRect().x(), dbTop);
 
  254     items.first()->setPos(pot);
 
  258   dbTop = sourceRect.top();
 
  260   foreach (QGraphicsItem *item, items) 
 
  264       QPointF pt(item->scenePos().x(), dbTop);
 
  272   QRectF sourceRect = getSelectionItemsBoundingBox();
 
  274   if(!sourceRect.isValid())
 
  277   QList<QGraphicsItem *> items = m_scene->selectedItems(); 
 
  278   double dbCenterHrz = 0;
 
  284   m_config->getPaperSize(ww, hh);
 
  286   if(items.count() == 1)
 
  290     w = items.first()->sceneBoundingRect().width() / 2.;
 
  291     QPointF pot(dbCenterHrz - w, items.first()->sceneBoundingRect().y());
 
  292     items.first()->setPos(pot);
 
  296   dbCenterHrz = sourceRect.center().x();
 
  298   foreach (QGraphicsItem *item, items) 
 
  302       w = item->sceneBoundingRect().width() / 2.;
 
  304       QPointF pt(dbCenterHrz - w, item->scenePos().y());
 
  312   QRectF sourceRect = getSelectionItemsBoundingBox();
 
  314   if(!sourceRect.isValid())
 
  317   QList<QGraphicsItem *> items = m_scene->selectedItems(); 
 
  318   double dbCenterVrt = 0;
 
  324   m_config->getPaperSize(ww, hh);
 
  326   if(items.count() == 1)
 
  330     h = items.first()->sceneBoundingRect().height() / 2.;
 
  331     QPointF pot(items.first()->sceneBoundingRect().x(), dbCenterVrt - h);
 
  332     items.first()->setPos(pot);
 
  336   dbCenterVrt = sourceRect.center().y();
 
  338   foreach (QGraphicsItem *item, items) 
 
  342       h = item->sceneBoundingRect().height() / 2.;
 
  344       QPointF pt(item->scenePos().x(), dbCenterVrt - h);
 
  353   QList<QGraphicsItem *> items = m_scene->selectedItems(); 
 
  355   foreach(QGraphicsItem *item, items) 
 
  357     sourceRect = sourceRect.united(item->sceneBoundingRect()); 
 
Class responsible for paper setting. Size, orientation, custom size, etc. 
 
AlignItems(QGraphicsScene *scene, PaperConfig *config)
 
virtual void alignRight()
 
const double & getUpperRightX() const 
It returns a constant refernce to the x coordinate of the upper right corner. 
 
const double & getLowerLeftY() const 
It returns a constant refernce to the y coordinate of the lower left corner. 
 
Class applying the alignment of one or more objects. Ex .: send to back, bring to front...
 
Abstract class to represent an observer. "View" part of MVC component. All classes representing the g...
 
const double & getUpperRightY() const 
It returns a constant refernce to the x coordinate of the upper right corner. 
 
virtual void bringToFront()
 
virtual void sendToBack()
 
Coord2D getCenter() const 
It returns the rectangle's center coordinate. 
 
An Envelope defines a 2D rectangular region. 
 
virtual bool isCanChangeGraphicOrder()
Returns whether the graphic component to be or not send to back or bring to front. 
 
virtual void alignBottom()
 
virtual void alignCenterHorizontal()
 
const double & getLowerLeftX() const 
It returns a constant reference to the x coordinate of the lower left corner. 
 
virtual QRectF getSelectionItemsBoundingBox()
 
virtual void alignCenterVertical()