• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdesdk API Reference
  • KDE Home
  • Contact Us
 

umbrello/umbrello

  • sources
  • kde-4.14
  • kdesdk
  • umbrello
  • umbrello
  • widgets
umlwidget.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  * This program is free software; you can redistribute it and/or modify *
3  * it under the terms of the GNU General Public License as published by *
4  * the Free Software Foundation; either version 2 of the License, or *
5  * (at your option) any later version. *
6  * *
7  * copyright (C) 2002-2014 *
8  * Umbrello UML Modeller Authors <umbrello-devel@kde.org> *
9  ***************************************************************************/
10 
11 #include "umlwidget.h"
12 
13 // local includes
14 #include "associationwidget.h"
15 #include "classifier.h"
16 #include "classpropertiesdialog.h"
17 #include "cmds.h"
18 #include "debug_utils.h"
19 #include "docwindow.h"
20 #include "floatingtextwidget.h"
21 #include "idchangelog.h"
22 #include "listpopupmenu.h"
23 #include "settingsdialog.h"
24 #include "uml.h"
25 #include "umldoc.h"
26 #include "umllistview.h"
27 #include "umlobject.h"
28 #include "umlscene.h"
29 #include "umlview.h"
30 #include "uniqueid.h"
31 
32 // kde includes
33 #include <kcolordialog.h>
34 #include <kfontdialog.h>
35 #include <klocale.h>
36 #include <kmessagebox.h>
37 
38 // qt includes
39 #include <QApplication>
40 #include <QColor>
41 #include <QPainter>
42 #include <QPointer>
43 
44 using namespace Uml;
45 
46 DEBUG_REGISTER_DISABLED(UMLWidget)
47 
48 const QSizeF UMLWidget::DefaultMinimumSize(50, 20);
49 const QSizeF UMLWidget::DefaultMaximumSize(1000, 5000);
50 
59 UMLWidget::UMLWidget(UMLScene * scene, WidgetType type, UMLObject * o)
60  : WidgetBase(scene, type)
61 {
62  init();
63  m_umlObject = o;
64  if (m_umlObject) {
65  connect(m_umlObject, SIGNAL(modified()), this, SLOT(updateWidget()));
66  m_nId = m_umlObject->id();
67  }
68 }
69 
79 UMLWidget::UMLWidget(UMLScene *scene, WidgetType type, Uml::ID::Type id)
80  : WidgetBase(scene, type)
81 {
82  init();
83  if (id == Uml::ID::None)
84  m_nId = UniqueID::gen();
85  else
86  m_nId = id;
87 }
88 
92 UMLWidget::~UMLWidget()
93 {
94  cleanup();
95 }
96 
100 UMLWidget& UMLWidget::operator=(const UMLWidget & other)
101 {
102  if (this == &other)
103  return *this;
104 
105  WidgetBase::operator=(other);
106 
107  // assign members loaded/saved
108  m_useFillColor = other.m_useFillColor;
109  m_usesDiagramFillColor = other.m_usesDiagramFillColor;
110  m_usesDiagramUseFillColor = other.m_usesDiagramUseFillColor;
111  m_fillColor = other.m_fillColor;
112  m_Assocs = other.m_Assocs;
113  m_isInstance = other.m_isInstance;
114  m_instanceName = other.m_instanceName;
115  m_instanceName = other.m_instanceName;
116  m_showStereotype = other.m_showStereotype;
117  setX(other.x());
118  setY(other.y());
119  setRect(rect().x(), rect().y(), other.width(), other.height());
120 
121  // assign volatile (non-saved) members
122  m_startMove = other.m_startMove;
123  m_nPosX = other.m_nPosX;
124  m_doc = other.m_doc; //new
125  m_resizable = other.m_resizable;
126  for (unsigned i = 0; i < FT_INVALID; ++i)
127  m_pFontMetrics[i] = other.m_pFontMetrics[i];
128  m_activated = other.m_activated;
129  m_ignoreSnapToGrid = other.m_ignoreSnapToGrid;
130  m_ignoreSnapComponentSizeToGrid = other.m_ignoreSnapComponentSizeToGrid;
131  return *this;
132 }
133 
137 bool UMLWidget::operator==(const UMLWidget& other) const
138 {
139  if (this == &other)
140  return true;
141 
142  if (m_baseType != other.m_baseType) {
143  return false;
144  }
145 
146  if (id() != other.id())
147  return false;
148 
149  /* Testing the associations is already an exaggeration, no?
150  The type and ID should uniquely identify an UMLWidget.
151  */
152  if (m_Assocs.count() != other.m_Assocs.count()) {
153  return false;
154  }
155 
156  // if(getBaseType() != wt_Text) // DON'T do this for floatingtext widgets, an infinite loop will result
157  // {
158  AssociationWidgetListIt assoc_it(m_Assocs);
159  AssociationWidgetListIt assoc_it2(other.m_Assocs);
160  AssociationWidget * assoc = 0, *assoc2 = 0;
161  while (assoc_it.hasNext() && assoc_it2.hasNext()) {
162  assoc = assoc_it.next();
163  assoc2 = assoc_it2.next();
164 
165  if (!(*assoc == *assoc2)) {
166  return false;
167  }
168  }
169  // }
170  return true;
171  // NOTE: In the comparison tests we are going to do, we don't need these values.
172  // They will actually stop things functioning correctly so if you change these, be aware of that.
173  /*
174  if(m_useFillColor != other.m_useFillColor)
175  return false;
176  if(m_nId != other.m_nId)
177  return false;
178  if(m_nX != other.m_nX)
179  return false;
180  if(m_nY != other.m_nY)
181  return false;
182  */
183 }
184 
190 void UMLWidget::setLocalID(Uml::ID::Type id)
191 {
192  m_nLocalID = id;
193 }
194 
202 Uml::ID::Type UMLWidget::localID() const
203 {
204  return m_nLocalID;
205 }
206 
219 UMLWidget* UMLWidget::widgetWithID(Uml::ID::Type id)
220 {
221  if (id == m_nLocalID ||
222  (m_umlObject != NULL && id == m_umlObject->id()) ||
223  id == m_nId)
224  return this;
225  return NULL;
226 }
227 
233 QSizeF UMLWidget::minimumSize() const
234 {
235  return m_minimumSize;
236 }
237 
244 void UMLWidget::setMinimumSize(const QSizeF& newSize)
245 {
246  m_minimumSize = newSize;
247 }
248 
254 QSizeF UMLWidget::maximumSize()
255 {
256  return m_maximumSize;
257 }
258 
265 void UMLWidget::setMaximumSize(const QSizeF& newSize)
266 {
267  m_maximumSize = newSize;
268 }
269 
273 void UMLWidget::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
274 {
275  WidgetBase::contextMenuEvent(event);
276 }
277 
295 void UMLWidget::moveWidgetBy(qreal diffX, qreal diffY)
296 {
297  setX(x() + diffX);
298  setY(y() + diffY);
299 }
300 
318 void UMLWidget::constrainMovementForAllWidgets(qreal &diffX, qreal &diffY)
319 {
320  Q_UNUSED(diffX) Q_UNUSED(diffY)
321 }
322 
326 void UMLWidget::toForeground()
327 {
328  QRectF rect = QRectF(scenePos(), QSizeF(width(), height()));
329  QList<QGraphicsItem*> items = scene()->items(rect, Qt::IntersectsItemShape, Qt::DescendingOrder);
330  DEBUG(DBG_SRC) << "items at " << rect << " = " << items.count();
331  if (items.count() > 1) {
332  foreach(QGraphicsItem* i, items) {
333  UMLWidget* w = dynamic_cast<UMLWidget*>(i);
334  if (w) {
335  DEBUG(DBG_SRC) << "item=" << w->name() << " with zValue=" << w->zValue();
336  if (w->name() != name()) {
337  if (w->zValue() >= zValue()) {
338  setZValue(w->zValue() + 1.0);
339  DEBUG(DBG_SRC) << "bring to foreground with zValue: " << zValue();
340  }
341  }
342  }
343  }
344  }
345  else {
346  setZValue(0.0);
347  }
348  DEBUG(DBG_SRC) << "zValue is " << zValue();
349 }
350 
378 void UMLWidget::mousePressEvent(QGraphicsSceneMouseEvent *event)
379 {
380  if (event->button() != Qt::LeftButton) {
381  event->ignore();
382  return;
383  }
384  event->accept();
385  DEBUG(DBG_SRC) << "widget = " << name() << " / type = " << baseTypeStr();
386 
387  toForeground();
388 
389  m_startMovePostion = pos();
390  m_startResizeSize = QSizeF(width(), height());
391 
392  // saving the values of the widget
393  m_pressOffset = event->scenePos() - pos();
394  DEBUG(DBG_SRC) << "press offset=" << m_pressOffset;
395 
396  m_oldStatusBarMsg = UMLApp::app()->statusBarMsg();
397 
398  if (event->modifiers() == Qt::ShiftModifier || event->modifiers() == Qt::ControlModifier) {
399  m_shiftPressed = true;
400 
401  if (event->button() == Qt::LeftButton) {
402  m_inMoveArea = true;
403  }
404 
405  if (!isSelected()) {
406  selectMultiple(event);
407  }
408  return;
409  }
410 
411  m_shiftPressed = false;
412 
413  int count = m_scene->selectedCount(true);
414  if (event->button() == Qt::LeftButton) {
415  if (isSelected() && count > 1) {
416  // single selection is made in release event if the widget wasn't moved
417  m_inMoveArea = true;
418  m_oldPos = pos();
419  return;
420  }
421 
422  if (isInResizeArea(event)) {
423  m_inResizeArea = true;
424  m_oldW = width();
425  m_oldH = height();
426  } else {
427  m_inMoveArea = true;
428  }
429  }
430 
431  // if widget wasn't selected, or it was selected but with other widgets also selected
432  if (!isSelected() || count > 1) {
433  selectSingle(event);
434  }
435 }
436 
468 void UMLWidget::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
469 {
470  if (m_inResizeArea) {
471  resize(event);
472  return;
473  }
474 
475  if (!m_moved) {
476  UMLApp::app()->document()->writeToStatusBar(i18n("Hold shift or ctrl to move in X axis. Hold shift and control to move in Y axis. Right button click to cancel move."));
477 
478  m_moved = true;
479  //Maybe needed by AssociationWidget
480  m_startMove = true;
481 
482  setSelectionBounds();
483  }
484 
485  QPointF position = event->scenePos() - m_pressOffset;
486  qreal diffX = position.x() - x();
487  qreal diffY = position.y() - y();
488 
489  if ((event->modifiers() & Qt::ShiftModifier) && (event->modifiers() & Qt::ControlModifier)) {
490  // move only in Y axis
491  diffX = 0;
492  } else if ((event->modifiers() & Qt::ShiftModifier) || (event->modifiers() & Qt::ControlModifier)) {
493  // move only in X axis
494  diffY = 0;
495  }
496 
497  constrainMovementForAllWidgets(diffX, diffY);
498 
499  // nothing to move
500  if (diffX == 0 && diffY == 0) {
501  return;
502  }
503 
504  QPointF delta = event->scenePos() - event->lastScenePos();
505  adjustUnselectedAssocs(delta.x(), delta.y());
506 
507  DEBUG(DBG_SRC) << "diffX=" << diffX << " / diffY=" << diffY;
508  foreach(UMLWidget* widget, umlScene()->selectedWidgets()) {
509  widget->moveWidgetBy(diffX, diffY);
510  widget->slotSnapToGrid();
511  }
512 
513  // Move any selected associations.
514  foreach(AssociationWidget* aw, m_scene->selectedAssocs()) {
515  if (aw->isSelected()) {
516  aw->moveEntireAssoc(diffX, diffY);
517  }
518  }
519 
520  umlScene()->resizeSceneToItems();
521 }
522 
546 void UMLWidget::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
547 {
548  if (!m_moved && !m_resized) {
549  if (!m_shiftPressed && (m_scene->selectedCount(true) > 1)) {
550  selectSingle(event);
551  } else if (!isSelected()) {
552  deselect(event);
553  }
554  } else {
555  // Commands
556  if (m_moved) {
557  int selectionCount = umlScene()->selectedWidgets().count();
558  if (selectionCount > 1) {
559  UMLApp::app()->beginMacro(i18n("Move widgets"));
560  }
561  foreach(UMLWidget* widget, umlScene()->selectedWidgets()) {
562  UMLApp::app()->executeCommand(new Uml::CmdMoveWidget(widget));
563  }
564  if (selectionCount > 1) {
565  UMLApp::app()->endMacro();
566  }
567  m_moved = false;
568  } else {
569  UMLApp::app()->executeCommand(new Uml::CmdResizeWidget(this));
570  m_resized = false;
571  }
572 
573  if ((m_inMoveArea && wasPositionChanged()) ||
574  (m_inResizeArea && wasSizeChanged())) {
575  umlDoc()->setModified(true);
576  }
577 
578  UMLApp::app()->document()->writeToStatusBar(m_oldStatusBarMsg);
579  }
580 
581  if (m_inResizeArea) {
582  m_inResizeArea = false;
583  m_scene->activeView()->setCursor(Qt::ArrowCursor);
584  } else {
585  m_inMoveArea = false;
586  }
587 }
588 
593 void UMLWidget::mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
594 {
595  if (event->button() == Qt::LeftButton) {
596  DEBUG(DBG_SRC) << "widget = " << name() << " / type = " << baseTypeStr();
597  switch(baseType()) {
598  case WidgetBase::wt_Message: // will be handled in its class
599  QGraphicsItem::mouseDoubleClickEvent(event);
600  break;
601  default:
602  showPropertiesDialog();
603  event->accept();
604  break;
605  }
606  }
607 }
608 
613 QPointF UMLWidget::startMovePosition() const
614 {
615  return m_startMovePostion;
616 }
617 
622 void UMLWidget::setStartMovePosition(const QPointF &position)
623 {
624  m_startMovePostion = position;
625 }
626 
631 QSizeF UMLWidget::startResizeSize() const
632 {
633  return m_startResizeSize;
634 }
635 
647 void UMLWidget::resizeWidget(qreal newW, qreal newH)
648 {
649  setSize(newW, newH);
650 }
651 
655 void UMLWidget::updateWidget()
656 {
657  updateGeometry();
658  switch (m_baseType) {
659  case WidgetBase::wt_Class:
660  m_scene->createAutoAttributeAssociations(this);
661  break;
662  case WidgetBase::wt_Entity:
663  m_scene->createAutoConstraintAssociations(this);
664  break;
665  default:
666  break;
667  }
668 
669  if (isVisible())
670  update();
671 }
672 
681 void UMLWidget::constrain(qreal& width, qreal& height)
682 {
683  QSizeF minSize = minimumSize();
684  if (width < minSize.width())
685  width = minSize.width();
686  if (height < minSize.height())
687  height = minSize.height();
688  QSizeF maxSize = maximumSize();
689  if (width > maxSize.width())
690  width = maxSize.width();
691  if (height > maxSize.height())
692  height = maxSize.height();
693 
694  if (fixedAspectRatio()) {
695  QSizeF size = rect().size();
696  float aspectRatio = size.width() > 0 ? (float)size.height()/size.width() : 1;
697  height = width * aspectRatio;
698  }
699 }
700 
704 void UMLWidget::init()
705 {
706  m_nId = Uml::ID::None;
707  m_nLocalID = UniqueID::gen();
708  m_isInstance = false;
709  setMinimumSize(DefaultMinimumSize);
710  setMaximumSize(DefaultMaximumSize);
711 
712  m_font = QApplication::font();
713  for (int i = (int)FT_INVALID - 1; i >= 0; --i) {
714  FontType fontType = (FontType)i;
715  setupFontType(m_font, fontType);
716  m_pFontMetrics[fontType] = new QFontMetrics(m_font);
717  }
718 
719  if (m_scene) {
720  m_useFillColor = true;
721  m_usesDiagramFillColor = true;
722  m_usesDiagramUseFillColor = true;
723  const Settings::OptionState& optionState = m_scene->optionState();
724  m_fillColor = optionState.uiState.fillColor;
725  m_showStereotype = optionState.classState.showStereoType;
726  } else {
727  uError() << "SERIOUS PROBLEM - m_scene is NULL";
728  m_useFillColor = false;
729  m_usesDiagramFillColor = false;
730  m_usesDiagramUseFillColor = false;
731  m_showStereotype = false;
732  }
733 
734  m_resizable = true;
735  m_fixedAspectRatio = false;
736 
737  m_startMove = false;
738  m_activated = false;
739  m_ignoreSnapToGrid = false;
740  m_ignoreSnapComponentSizeToGrid = false;
741  m_doc = UMLApp::app()->document();
742  m_nPosX = 0;
743  connect(m_scene, SIGNAL(sigFillColorChanged(Uml::ID::Type)), this, SLOT(slotFillColorChanged(Uml::ID::Type)));
744  connect(m_scene, SIGNAL(sigLineColorChanged(Uml::ID::Type)), this, SLOT(slotLineColorChanged(Uml::ID::Type)));
745  connect(m_scene, SIGNAL(sigTextColorChanged(Uml::ID::Type)), this, SLOT(slotTextColorChanged(Uml::ID::Type)));
746  connect(m_scene, SIGNAL(sigLineWidthChanged(Uml::ID::Type)), this, SLOT(slotLineWidthChanged(Uml::ID::Type)));
747 
748  m_umlObject = 0;
749 
750  m_oldPos = QPointF();
751  m_pressOffset = QPointF();
752  m_oldW = 0;
753  m_oldH = 0;
754 
755  m_shiftPressed = false;
756  m_inMoveArea = false;
757  m_inResizeArea = false;
758  m_moved = false;
759  m_resized = false;
760 
761  setZValue(2.0); // default for most widgets
762 }
763 
772 void UMLWidget::slotMenuSelection(QAction *trigger)
773 {
774  if (!trigger) {
775  return;
776  }
777 
778  ListPopupMenu::MenuType sel = ListPopupMenu::typeFromAction(trigger);
779  switch (sel) {
780  case ListPopupMenu::mt_Resize:
781  umlScene()->resizeSelection();
782  break;
783 
784  default:
785  WidgetBase::slotMenuSelection(trigger);
786  break;
787  }
788 }
789 
796 void UMLWidget::slotWidgetMoved(Uml::ID::Type /*id*/)
797 {
798 }
799 
805 void UMLWidget::slotFillColorChanged(Uml::ID::Type viewID)
806 {
807  //only change if on the diagram concerned
808  if (m_scene->ID() != viewID) {
809  return;
810  }
811  if (m_usesDiagramFillColor) {
812  WidgetBase::setFillColor(m_scene->fillColor());
813  }
814  if (m_usesDiagramUseFillColor) {
815  WidgetBase::setUseFillColor(m_scene->useFillColor());
816  }
817  update();
818 }
819 
825 void UMLWidget::slotTextColorChanged(Uml::ID::Type viewID)
826 {
827  //only change if on the diagram concerned
828  if (m_scene->ID() != viewID)
829  return;
830  WidgetBase::setTextColor(m_scene->textColor());
831  update();
832 }
833 
834 
840 void UMLWidget::slotLineColorChanged(Uml::ID::Type viewID)
841 {
842  //only change if on the diagram concerned
843  if (m_scene->ID() != viewID)
844  return;
845 
846  if (m_usesDiagramLineColor) {
847  WidgetBase::setLineColor(m_scene->lineColor());
848  }
849  update();
850 }
851 
857 void UMLWidget::slotLineWidthChanged(Uml::ID::Type viewID)
858 {
859  //only change if on the diagram concerned
860  if (m_scene->ID() != viewID) {
861  return;
862  }
863  if (m_usesDiagramLineWidth) {
864  WidgetBase::setLineWidth(m_scene->lineWidth());
865  }
866  update();
867 }
868 
874 void UMLWidget::setUseFillColor(bool fc)
875 {
876  if (useFillColor() != fc) {
877  UMLApp::app()->executeCommand(new CmdChangeUseFillColor(this, fc));
878  }
879 }
880 
886 void UMLWidget::setUseFillColorCmd(bool fc)
887 {
888  WidgetBase::setUseFillColor(fc);
889  update();
890 }
891 
895 void UMLWidget::setTextColorCmd(const QColor &color)
896 {
897  WidgetBase::setTextColor(color);
898  update();
899 }
900 
904 void UMLWidget::setTextColor(const QColor &color)
905 {
906  if (textColor() != color) {
907  UMLApp::app()->executeCommand(new CmdChangeTextColor(this, color));
908  update();
909  }
910 }
911 
915 void UMLWidget::setLineColorCmd(const QColor &color)
916 {
917  WidgetBase::setLineColor(color);
918  update();
919 }
920 
924 void UMLWidget::setLineColor(const QColor &color)
925 {
926  if (lineColor() != color) {
927  UMLApp::app()->executeCommand(new CmdChangeLineColor(this, color));
928  }
929 }
930 
934 void UMLWidget::setLineWidth(uint width)
935 {
936  if (lineWidth() != width) {
937  UMLApp::app()->executeCommand(new CmdChangeLineWidth(this, width));
938  }
939 }
940 
944 void UMLWidget::setLineWidthCmd(uint width)
945 {
946  WidgetBase::setLineWidth(width);
947  update();
948 }
949 
955 void UMLWidget::setFillColor(const QColor &color)
956 {
957  if (fillColor() != color) {
958  UMLApp::app()->executeCommand(new CmdChangeFillColor(this, color));
959  }
960 }
961 
967 void UMLWidget::setFillColorCmd(const QColor &color)
968 {
969  WidgetBase::setFillColor(color);
970  update();
971 }
972 
979 bool UMLWidget::activate(IDChangeLog* /*ChangeLog = 0 */)
980 {
981  if (widgetHasUMLObject(m_baseType) && m_umlObject == NULL) {
982  m_umlObject = m_doc->findObjectById(m_nId);
983  if (m_umlObject == NULL) {
984  uError() << "cannot find UMLObject with id=" << Uml::ID::toString(m_nId);
985  return false;
986  }
987  }
988  setFontCmd(m_font);
989  setSize(width(), height());
990  m_activated = true;
991  updateGeometry();
992  if (m_scene->getPaste()) {
993  FloatingTextWidget * ft = 0;
994  QPointF point = m_scene->getPastePoint();
995  int x = point.x() + this->x();
996  int y = point.y() + this->y();
997  if (m_scene->type() == Uml::DiagramType::Sequence) {
998  switch (baseType()) {
999  case WidgetBase::wt_Object:
1000  case WidgetBase::wt_Precondition :
1001  setY(this->y());
1002  setX(x);
1003  break;
1004 
1005  case WidgetBase::wt_Message:
1006  setY(this->y());
1007  setX(x);
1008  break;
1009 
1010  case WidgetBase::wt_Text:
1011  ft = static_cast<FloatingTextWidget *>(this);
1012  if (ft->textRole() == Uml::TextRole::Seq_Message) {
1013  setX(x);
1014  setY(this->y());
1015  } else {
1016  setX(this->x());
1017  setY(this->y());
1018  }
1019  break;
1020 
1021  default:
1022  setY(y);
1023  break;
1024  }//end switch base type
1025  }//end if sequence
1026  else {
1027  setX(x);
1028  setY(y);
1029  }
1030  }//end if pastepoint
1031  else {
1032  setX(this->x());
1033  setY(this->y());
1034  }
1035  if (m_scene->getPaste())
1036  m_scene->createAutoAssociations(this);
1037  updateGeometry();
1038  return true;
1039 }
1040 
1046 bool UMLWidget::isActivated() const
1047 {
1048  return m_activated;
1049 }
1050 
1056 void UMLWidget::setActivated(bool active /*=true*/)
1057 {
1058  m_activated = active;
1059 }
1060 
1065 void UMLWidget::addAssoc(AssociationWidget* pAssoc)
1066 {
1067  if (pAssoc && !m_Assocs.contains(pAssoc)) {
1068  m_Assocs.append(pAssoc);
1069  }
1070 }
1071 
1076 void UMLWidget::removeAssoc(AssociationWidget* pAssoc)
1077 {
1078  if (pAssoc) {
1079  m_Assocs.removeAll(pAssoc);
1080  }
1081 }
1082 
1089 void UMLWidget::adjustAssocs(qreal dx, qreal dy)
1090 {
1091  // don't adjust Assocs on file load, as
1092  // the original positions, which are stored in XMI
1093  // should be reproduced exactly
1094  // (don't try to reposition assocs as long
1095  // as file is only partly loaded -> reposition
1096  // could be misguided)
1098  if (m_doc->loading()) {
1099  // don't recalculate the assocs during load of XMI
1100  // -> return immediately without action
1101  return;
1102  }
1103 
1104  foreach(AssociationWidget* assocwidget, m_Assocs) {
1105  assocwidget->saveIdealTextPositions();
1106  }
1107 
1108  foreach(AssociationWidget* assocwidget, m_Assocs) {
1109  assocwidget->widgetMoved(this, dx, dy);
1110  }
1111 }
1112 
1119 void UMLWidget::adjustUnselectedAssocs(qreal dx, qreal dy)
1120 {
1121  foreach(AssociationWidget* assocwidget, m_Assocs) {
1122  if (!assocwidget->isSelected())
1123  assocwidget->saveIdealTextPositions();
1124  }
1125 
1126  foreach(AssociationWidget* assocwidget, m_Assocs) {
1127  if (!assocwidget->isSelected()) {
1128  assocwidget->widgetMoved(this, dx, dy);
1129  }
1130  }
1131 }
1132 
1136 void UMLWidget::showPropertiesDialog()
1137 {
1138  // will already be selected so make sure docWindow updates the doc
1139  // back it the widget
1140  UMLApp::app()->docWindow()->updateDocumentation(false);
1141  QPointer<ClassPropertiesDialog> dlg = new ClassPropertiesDialog((QWidget*)UMLApp::app(), this);
1142 
1143  if (dlg->exec()) {
1144  UMLApp::app()->docWindow()->showDocumentation(umlObject(), true);
1145  m_doc->setModified(true);
1146  }
1147  dlg->close(); //wipe from memory
1148  delete dlg;
1149 }
1150 
1155 void UMLWidget::moveByLocal(qreal dx, qreal dy)
1156 {
1157  qreal newX = x() + dx;
1158  qreal newY = y() + dy;
1159  setX(newX);
1160  setY(newY);
1161  adjustAssocs(dx, dy);
1162 }
1163 
1167 void UMLWidget::setPenFromSettings(QPainter & p)
1168 {
1169  p.setPen(QPen(m_lineColor, m_lineWidth));
1170 }
1171 
1175 void UMLWidget::setPenFromSettings(QPainter *p)
1176 {
1177  p->setPen(QPen(m_lineColor, m_lineWidth));
1178 }
1179 
1186 QCursor UMLWidget::resizeCursor() const
1187 {
1188  return Qt::SizeFDiagCursor;
1189 }
1190 
1199 bool UMLWidget::isInResizeArea(QGraphicsSceneMouseEvent *me)
1200 {
1201  qreal m = 10.0;
1202  const qreal w = width();
1203  const qreal h = height();
1204 
1205  // If the widget itself is very small then make the resize area small, too.
1206  // Reason: Else it becomes impossible to do a move instead of resize.
1207  if (w - m < m || h - m < m) {
1208  m = 2.0;
1209  }
1210 
1211  if (m_resizable &&
1212  me->scenePos().x() >= (x() + w - m) &&
1213  me->scenePos().y() >= (y() + h - m)) {
1214  m_scene->activeView()->setCursor(resizeCursor());
1215  return true;
1216  } else {
1217  m_scene->activeView()->setCursor(Qt::ArrowCursor);
1218  return false;
1219  }
1220 }
1221 
1227 QSizeF UMLWidget::calculateSize(bool withExtensions /* = true */) const
1228 {
1229  Q_UNUSED(withExtensions)
1230  return QSizeF(width(), height());
1231 }
1232 
1236 void UMLWidget::resize()
1237 {
1238  qreal oldW = width();
1239  qreal oldH = height();
1240  // @TODO minimumSize() do not work in all cases, we need a dedicated autoResize() method
1241  QSizeF size = minimumSize();
1242  setSize(size.width(), size.height());
1243  DEBUG(DBG_SRC) << "size=" << size;
1244  adjustAssocs(size.width()-oldW, size.height()-oldH);
1245 }
1246 
1255 void UMLWidget::resize(QGraphicsSceneMouseEvent *me)
1256 {
1257  // TODO the status message lies for at least MessageWidget which could only be resized vertical
1258  UMLApp::app()->document()->writeToStatusBar(i18n("Hold shift or ctrl to move in X axis. Hold shift and control to move in Y axis. Right button click to cancel resize."));
1259 
1260  m_resized = true;
1261 
1262  qreal newW = m_oldW + me->scenePos().x() - x() - m_pressOffset.x();
1263  qreal newH = m_oldH + me->scenePos().y() - y() - m_pressOffset.y();
1264 
1265  if ((me->modifiers() & Qt::ShiftModifier) && (me->modifiers() & Qt::ControlModifier)) {
1266  //Move in Y axis
1267  newW = m_oldW;
1268  } else if ((me->modifiers() & Qt::ShiftModifier) || (me->modifiers() & Qt::ControlModifier)) {
1269  //Move in X axis
1270  newH = m_oldH;
1271  }
1272 
1273  constrain(newW, newH);
1274  resizeWidget(newW, newH);
1275  DEBUG(DBG_SRC) << "event=" << me->scenePos() << "/ pos=" << pos() << " / newW=" << newW << " / newH=" << newH;
1276  QPointF delta = me->scenePos() - me->lastScenePos();
1277  adjustAssocs(delta.x(), delta.y());
1278 
1279  m_scene->resizeSceneToItems();
1280 }
1281 
1288 bool UMLWidget::wasSizeChanged()
1289 {
1290  return m_oldW != width() || m_oldH != height();
1291 }
1292 
1299 bool UMLWidget::wasPositionChanged()
1300 {
1301  return m_oldPos != pos();
1302 }
1303 
1307 void UMLWidget::setSelectionBounds()
1308 {
1309 }
1310 
1311 void UMLWidget::setSelectedFlag(bool _select)
1312 {
1313  WidgetBase::setSelected(_select);
1314 }
1315 
1321 void UMLWidget::setSelected(bool _select)
1322 {
1323  WidgetBase::setSelected(_select);
1324  const WidgetBase::WidgetType wt = m_baseType;
1325  if (_select) {
1326  if (m_scene->selectedCount() == 0) {
1327  if (widgetHasUMLObject(wt)) {
1328  UMLApp::app()->docWindow()->showDocumentation(m_umlObject, false);
1329  } else {
1330  UMLApp::app()->docWindow()->showDocumentation(this, false);
1331  }
1332  }//end if
1333  /* if (wt != wt_Text && wt != wt_Box) {
1334  setZ(9);//keep text on top and boxes behind so don't touch Z value
1335  } */
1336  } else {
1337  /* if (wt != wt_Text && wt != wt_Box) {
1338  setZ(m_origZ);
1339  } */
1340  if (isSelected())
1341  UMLApp::app()->docWindow()->updateDocumentation(true);
1342  }
1343 
1344  // TODO: isn't this handled by toForeground() ?
1345  const QPoint pos(x(), y());
1346  UMLWidget *bkgnd = m_scene->widgetAt(pos);
1347  if (bkgnd && bkgnd != this && _select) {
1348  DEBUG(DBG_SRC) << "setting Z to " << bkgnd->zValue() + 1.0 << ", SelectState: " << _select;
1349  setZValue(bkgnd->zValue() + 1.0);
1350  }
1351 
1352  update();
1353 
1354  // selection changed, we have to make sure the copy and paste items
1355  // are correctly enabled/disabled
1356  UMLApp::app()->slotCopyChanged();
1357 
1358  // select in tree view as done for diagrams
1359  if (_select) {
1360  UMLListViewItem * item = UMLApp::app()->listView()->findItem(id());
1361  if (item)
1362  UMLApp::app()->listView()->setCurrentItem(item);
1363  else
1364  UMLApp::app()->listView()->clearSelection();
1365  }
1366 }
1367 
1373 void UMLWidget::selectSingle(QGraphicsSceneMouseEvent *me)
1374 {
1375  m_scene->clearSelected();
1376 
1377  // Adds the widget to the selected widgets list, but as it has been cleared
1378  // only the current widget is selected.
1379  selectMultiple(me);
1380 }
1381 
1387 void UMLWidget::selectMultiple(QGraphicsSceneMouseEvent *me)
1388 {
1389  Q_UNUSED(me);
1390 
1391  setSelected(true);
1392 }
1393 
1399 void UMLWidget::deselect(QGraphicsSceneMouseEvent *me)
1400 {
1401  Q_UNUSED(me);
1402 
1403  setSelected(false);
1404 }
1405 
1409 //void UMLWidget::resetSelection()
1410 //{
1411 // m_scene->clearSelected();
1412 // m_scene->resetToolbar();
1413 // setSelected(false);
1414 //}
1415 
1421 void UMLWidget::setScene(UMLScene *scene)
1422 {
1423  //remove signals from old view - was probably 0 anyway
1424  disconnect(m_scene, SIGNAL(sigFillColorChanged(Uml::ID::Type)), this, SLOT(slotFillColorChanged(Uml::ID::Type)));
1425  disconnect(m_scene, SIGNAL(sigTextColorChanged(Uml::ID::Type)), this, SLOT(slotTextColorChanged(Uml::ID::Type)));
1426  disconnect(m_scene, SIGNAL(sigLineWidthChanged(Uml::ID::Type)), this, SLOT(slotLineWidthChanged(Uml::ID::Type)));
1427  m_scene = scene;
1428  connect(m_scene, SIGNAL(sigFillColorChanged(Uml::ID::Type)), this, SLOT(slotFillColorChanged(Uml::ID::Type)));
1429  connect(m_scene, SIGNAL(sigTextColorChanged(Uml::ID::Type)), this, SLOT(slotTextColorChanged(Uml::ID::Type)));
1430  connect(m_scene, SIGNAL(sigLineWidthChanged(Uml::ID::Type)), this, SLOT(slotLineWidthChanged(Uml::ID::Type)));
1431 }
1432 
1440 void UMLWidget::setX(qreal x)
1441 {
1442  QGraphicsObject::setX(x);
1443 }
1444 
1452 void UMLWidget::setY(qreal y)
1453 {
1454  QGraphicsObject::setY(y);
1455 }
1456 
1461 void UMLWidget::cleanup()
1462 {
1463 }
1464 
1469 void UMLWidget::slotSnapToGrid()
1470 {
1471  if (!m_ignoreSnapToGrid) {
1472  qreal newX = m_scene->snappedX(x());
1473  setX(newX);
1474  qreal newY = m_scene->snappedY(y());
1475  setY(newY);
1476  }
1477 }
1478 
1482 bool UMLWidget::widgetHasUMLObject(WidgetBase::WidgetType type)
1483 {
1484  if (type == WidgetBase::wt_Actor ||
1485  type == WidgetBase::wt_UseCase ||
1486  type == WidgetBase::wt_Class ||
1487  type == WidgetBase::wt_Interface ||
1488  type == WidgetBase::wt_Enum ||
1489  type == WidgetBase::wt_Datatype ||
1490  type == WidgetBase::wt_Package ||
1491  type == WidgetBase::wt_Component ||
1492  type == WidgetBase::wt_Port ||
1493  type == WidgetBase::wt_Node ||
1494  type == WidgetBase::wt_Artifact ||
1495  type == WidgetBase::wt_Object) {
1496  return true;
1497  } else {
1498  return false;
1499  }
1500 }
1501 
1505 void UMLWidget::setIgnoreSnapToGrid(bool to)
1506 {
1507  m_ignoreSnapToGrid = to;
1508 }
1509 
1513 bool UMLWidget::getIgnoreSnapToGrid() const
1514 {
1515  return m_ignoreSnapToGrid;
1516 }
1517 
1523 void UMLWidget::setSize(qreal width, qreal height)
1524 {
1525  // snap to the next larger size that is a multiple of the grid
1526  if (!m_ignoreSnapComponentSizeToGrid
1527  && m_scene->snapComponentSizeToGrid()) {
1528  // integer divisions
1529  int numX = width / m_scene->snapX();
1530  int numY = height / m_scene->snapY();
1531  // snap to the next larger valid value
1532  if (width > numX * m_scene->snapX())
1533  width = (numX + 1) * m_scene->snapX();
1534  if (height > numY * m_scene->snapY())
1535  height = (numY + 1) * m_scene->snapY();
1536  }
1537 
1538  setRect(rect().x(), rect().y(), width, height);
1539 }
1540 
1544 void UMLWidget::setSize(const QSizeF& size)
1545 {
1546  setSize(size.width(), size.height());
1547 }
1548 
1552 void UMLWidget::updateGeometry()
1553 {
1554  if (m_doc->loading()) {
1555  return;
1556  }
1557  qreal oldW = width();
1558  qreal oldH = height();
1559  QSizeF size = calculateSize();
1560  qreal clipWidth = size.width();
1561  qreal clipHeight = size.height();
1562  constrain(clipWidth, clipHeight);
1563  setSize(clipWidth, clipHeight);
1564  slotSnapToGrid();
1565  adjustAssocs(size.width()-oldW, size.height()-oldH);
1566 }
1567 
1572 void UMLWidget::clipSize()
1573 {
1574  qreal clipWidth = width();
1575  qreal clipHeight = height();
1576  constrain(clipWidth, clipHeight);
1577  setSize(clipWidth, clipHeight);
1578 }
1579 
1583 void UMLWidget::setDefaultFontMetrics(QFont &font, UMLWidget::FontType fontType)
1584 {
1585  setupFontType(font, fontType);
1586  setFontMetrics(fontType, QFontMetrics(font));
1587 }
1588 
1589 void UMLWidget::setupFontType(QFont &font, UMLWidget::FontType fontType)
1590 {
1591  switch (fontType) {
1592  case FT_NORMAL:
1593  font.setBold(false);
1594  font.setItalic(false);
1595  font.setUnderline(false);
1596  break;
1597  case FT_BOLD:
1598  font.setBold(true);
1599  font.setItalic(false);
1600  font.setUnderline(false);
1601  break;
1602  case FT_ITALIC:
1603  font.setBold(false);
1604  font.setItalic(true);
1605  font.setUnderline(false);
1606  break;
1607  case FT_UNDERLINE:
1608  font.setBold(false);
1609  font.setItalic(false);
1610  font.setUnderline(true);
1611  break;
1612  case FT_BOLD_ITALIC:
1613  font.setBold(true);
1614  font.setItalic(true);
1615  font.setUnderline(false);
1616  break;
1617  case FT_BOLD_UNDERLINE:
1618  font.setBold(true);
1619  font.setItalic(false);
1620  font.setUnderline(true);
1621  break;
1622  case FT_ITALIC_UNDERLINE:
1623  font.setBold(false);
1624  font.setItalic(true);
1625  font.setUnderline(true);
1626  break;
1627  case FT_BOLD_ITALIC_UNDERLINE:
1628  font.setBold(true);
1629  font.setItalic(true);
1630  font.setUnderline(true);
1631  break;
1632  default: return;
1633  }
1634 }
1635 
1636 void UMLWidget::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
1637 {
1638  Q_UNUSED(option);
1639  Q_UNUSED(widget);
1640 
1641  if (option->state & QStyle::State_Selected) {
1642  const qreal w = width();
1643  const qreal h = height();
1644  const qreal s = 4;
1645  QBrush brush(Qt::blue);
1646  painter->fillRect(0, 0, s, s, brush);
1647  painter->fillRect(0, 0 + h - s, s, s, brush);
1648  painter->fillRect(0 + w - s, 0, s, s, brush);
1649 
1650  // Draw the resize anchor in the lower right corner.
1651  // Don't draw it if the widget is so small that the
1652  // resize anchor would cover up most of the widget.
1653  if (m_resizable && w * h > (s*3) * (s*3)) {
1654  brush.setColor(Qt::red);
1655  const int right = 0 + w;
1656  const int bottom = 0 + h;
1657  painter->drawLine(right - s, 0 + h - 1, 0 + w - 1, 0 + h - s);
1658  painter->drawLine(right - (s*2), bottom - 1, right - 1, bottom - (s*2));
1659  painter->drawLine(right - (s*3), bottom - 1, right - 1, bottom - (s*3));
1660  } else {
1661  painter->fillRect(0 + w - s, 0 + h - s, s, s, brush);
1662  }
1663  // debug info
1664  if (Tracer::instance()->isEnabled(QLatin1String(metaObject()->className()))) {
1665  painter->setPen(Qt::green);
1666  painter->setBrush(Qt::NoBrush);
1667  painter->drawPath(shape());
1668  painter->setPen(Qt::red);
1669  painter->drawRect(boundingRect());
1670  // origin
1671  painter->drawLine(-10, 0, 10, 0);
1672  painter->drawLine(0, -10, 0, 10);
1673  }
1674  }
1675 
1676  if (umlScene()->isShowDocumentationIndicator() && hasDocumentation()) {
1677  const qreal h = height();
1678  const qreal d = 8;
1679  QPolygonF p;
1680  p << QPointF(0, h - d) << QPointF(d, h) << QPointF(0, h);
1681  painter->setPen(Qt::blue);
1682  painter->setBrush(Qt::red);
1683  painter->drawPolygon(p);
1684  }
1685 }
1686 
1690 void UMLWidget::setDefaultFontMetrics(QFont &font, UMLWidget::FontType fontType, QPainter &painter)
1691 {
1692  setupFontType(font, fontType);
1693  painter.setFont(font);
1694  setFontMetrics(fontType, painter.fontMetrics());
1695 }
1696 
1701 QFontMetrics &UMLWidget::getFontMetrics(UMLWidget::FontType fontType) const
1702 {
1703  return *m_pFontMetrics[fontType];
1704 }
1705 
1709 void UMLWidget::setFontMetrics(UMLWidget::FontType fontType, QFontMetrics fm)
1710 {
1711  delete m_pFontMetrics[fontType];
1712  m_pFontMetrics[fontType] = new QFontMetrics(fm);
1713 }
1714 
1720 void UMLWidget::setFont(const QFont &font)
1721 {
1722  QFont newFont = font;
1723  forceUpdateFontMetrics(newFont, 0);
1724 
1725  if (m_font != newFont) {
1726  UMLApp::app()->executeCommand(new CmdChangeFont(this, font));
1727  }
1728 }
1729 
1735 void UMLWidget::setFontCmd(const QFont &font)
1736 {
1737  WidgetBase::setFont(font);
1738  forceUpdateFontMetrics(0);
1739  if (m_doc->loading())
1740  return;
1741  update();
1742 }
1743 
1747 void UMLWidget::forceUpdateFontMetrics(QPainter *painter)
1748 {
1749  forceUpdateFontMetrics(m_font, painter);
1750 }
1751 
1759 void UMLWidget::forceUpdateFontMetrics(QFont& font, QPainter *painter)
1760 {
1761  if (painter == 0) {
1762  for (int i = (int)FT_INVALID - 1; i >= 0; --i) {
1763  if (m_pFontMetrics[(UMLWidget::FontType)i] != 0)
1764  setDefaultFontMetrics(font, (UMLWidget::FontType)i);
1765  }
1766  } else {
1767  for (int i2 = (int)FT_INVALID - 1; i2 >= 0; --i2) {
1768  if (m_pFontMetrics[(UMLWidget::FontType)i2] != 0)
1769  setDefaultFontMetrics(font, (UMLWidget::FontType)i2, *painter);
1770  }
1771  }
1772  if (m_doc->loading())
1773  return;
1774  // calculate the size, based on the new font metric
1775  updateGeometry();
1776 }
1777 
1783 void UMLWidget::setShowStereotype(bool flag)
1784 {
1785  m_showStereotype = flag;
1786  updateGeometry();
1787  update();
1788 }
1789 
1795 bool UMLWidget::showStereotype() const
1796 {
1797  return m_showStereotype;
1798 }
1799 
1805 void UMLWidget::moveEvent(QGraphicsSceneMouseEvent* me)
1806 {
1807  Q_UNUSED(me)
1808 }
1809 
1810 void UMLWidget::saveToXMI(QDomDocument & qDoc, QDomElement & qElement)
1811 {
1812  /*
1813  Call after required actions in child class.
1814  Type must be set in the child class.
1815  */
1816  WidgetBase::saveToXMI(qDoc, qElement);
1817  qElement.setAttribute(QLatin1String("xmi.id"), Uml::ID::toString(id()));
1818  qElement.setAttribute(QLatin1String("x"), x());
1819  qElement.setAttribute(QLatin1String("y"), y());
1820  qElement.setAttribute(QLatin1String("width"), width());
1821  qElement.setAttribute(QLatin1String("height"), height());
1822  qElement.setAttribute(QLatin1String("isinstance"), m_isInstance);
1823  if (!m_instanceName.isEmpty())
1824  qElement.setAttribute(QLatin1String("instancename"), m_instanceName);
1825  if (m_showStereotype)
1826  qElement.setAttribute(QLatin1String("showstereotype"), m_showStereotype);
1827 
1828  // Unique identifier for widget (todo: id() should be unique, new attribute
1829  // should indicate the UMLObject's ID it belongs to)
1830  qElement.setAttribute(QLatin1String("localid"), Uml::ID::toString(m_nLocalID));
1831 }
1832 
1833 bool UMLWidget::loadFromXMI(QDomElement & qElement)
1834 {
1835  QString id = qElement.attribute(QLatin1String("xmi.id"), QLatin1String("-1"));
1836  m_nId = Uml::ID::fromString(id);
1837 
1838  WidgetBase::loadFromXMI(qElement);
1839  QString x = qElement.attribute(QLatin1String("x"), QLatin1String("0"));
1840  QString y = qElement.attribute(QLatin1String("y"), QLatin1String("0"));
1841  QString h = qElement.attribute(QLatin1String("height"), QLatin1String("0"));
1842  QString w = qElement.attribute(QLatin1String("width"), QLatin1String("0"));
1843 
1844  setSize(w.toFloat(), h.toFloat());
1845  setX(x.toFloat());
1846  setY(y.toFloat());
1847  QString isinstance = qElement.attribute(QLatin1String("isinstance"), QLatin1String("0"));
1848  m_isInstance = (bool)isinstance.toInt();
1849  m_instanceName = qElement.attribute(QLatin1String("instancename"));
1850  QString showstereo = qElement.attribute(QLatin1String("showstereotype"), QLatin1String("0"));
1851  m_showStereotype = (bool)showstereo.toInt();
1852 
1853  QString localid = qElement.attribute(QLatin1String("localid"), QLatin1String("0"));
1854  if (localid != QLatin1String("0")) {
1855  m_nLocalID = Uml::ID::fromString(localid);
1856  }
1857 
1858  return true;
1859 }
1860 
1861 #include "umlwidget.moc"
QObject::className
const char * className() const
UMLWidget::setScene
void setScene(UMLScene *scene)
Clears the selection, resets the toolbar and deselects the widget.
Definition: umlwidget.cpp:1421
UMLWidget::FT_UNDERLINE
Definition: umlwidget.h:218
UMLListViewItem
Items used by the class UMLListView.
Definition: umllistviewitem.h:38
UMLWidget::setStartMovePosition
void setStartMovePosition(const QPointF &position)
Set the start position of the move action.
Definition: umlwidget.cpp:622
UMLApp::slotCopyChanged
void slotCopyChanged()
Slot for enabling cut and copy to clipboard.
Definition: uml.cpp:1858
UMLWidget::selectMultiple
void selectMultiple(QGraphicsSceneMouseEvent *me)
Selects the widget and adds it to the list of selected widgets.
Definition: umlwidget.cpp:1387
umlobject.h
UMLWidget::setLocalID
void setLocalID(Uml::ID::Type id)
Sets the local id of the object.
Definition: umlwidget.cpp:190
UMLWidget::widgetHasUMLObject
static bool widgetHasUMLObject(WidgetBase::WidgetType type)
Returns whether the widget type has an associated UMLObject.
Definition: umlwidget.cpp:1482
QGraphicsItem::x
qreal x() const
QGraphicsItem::y
qreal y() const
QWidget
UMLWidget::resizeCursor
virtual QCursor resizeCursor() const
Returns the cursor to be shown when resizing the widget.
Definition: umlwidget.cpp:1186
UniqueID::init
void init()
Reinitialize the unique ID counter.
Definition: uniqueid.cpp:37
UMLWidget::m_inMoveArea
bool m_inMoveArea
If cursor was in move/resize area when left button was pressed (and no other widgets were selected)...
Definition: umlwidget.h:332
UMLScene::useFillColor
bool useFillColor() const
Returns whether to use the fill/background color.
Definition: umlscene.cpp:1258
WidgetBase::m_usesDiagramLineWidth
bool m_usesDiagramLineWidth
Definition: widgetbase.h:188
WidgetBase::wt_Precondition
Definition: widgetbase.h:64
UMLWidget::slotTextColorChanged
virtual void slotTextColorChanged(Uml::ID::Type viewID)
Captures a text color change signal.
Definition: umlwidget.cpp:825
WidgetBase::wt_Package
Definition: widgetbase.h:51
UMLWidget::m_resized
bool m_resized
Definition: umlwidget.h:339
UMLWidget::m_pressOffset
QPointF m_pressOffset
The X/Y offset from the position of the cursor when it was pressed to the upper left corner of the wi...
Definition: umlwidget.h:317
UMLWidget::slotLineColorChanged
virtual void slotLineColorChanged(Uml::ID::Type viewID)
Captures a line color change signal.
Definition: umlwidget.cpp:840
UMLWidget::m_resizable
bool m_resizable
Definition: umlwidget.h:297
UMLScene::selectedCount
int selectedCount(bool filterText=false) const
Return the amount of widgets selected.
Definition: umlscene.cpp:1822
UMLWidget::setIgnoreSnapToGrid
void setIgnoreSnapToGrid(bool to)
Set m_ignoreSnapToGrid.
Definition: umlwidget.cpp:1505
UMLScene::resizeSceneToItems
void resizeSceneToItems()
Sets the size of the scene to just fit on all the items.
Definition: umlscene.cpp:3497
UniqueID::gen
Uml::ID::Type gen()
MAIN FUNCTION: Return a new unique ID.
Definition: uniqueid.cpp:26
UMLScene::snappedX
qreal snappedX(qreal x)
Returns the input coordinate with possible grid-snap applied.
Definition: umlscene.cpp:3402
WidgetBase::umlObject
UMLObject * umlObject() const
Returns the UMLObject set to represent.
Definition: widgetbase.cpp:127
UMLWidget::mouseMoveEvent
virtual void mouseMoveEvent(QGraphicsSceneMouseEvent *event)
Handles a mouse move event.
Definition: umlwidget.cpp:468
UMLWidget::paint
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget=0)
Draws the UMLWidget on the given paint device.
Definition: umlwidget.cpp:1636
QWidget::setCursor
void setCursor(const QCursor &)
UMLScene::lineWidth
uint lineWidth() const
Returns the line width to use.
Definition: umlscene.cpp:370
QGraphicsView::items
QList< QGraphicsItem * > items() const
QPainter::fillRect
void fillRect(const QRectF &rectangle, const QBrush &brush)
UMLWidget::fixedAspectRatio
bool fixedAspectRatio() const
Definition: umlwidget.h:206
UMLWidget::DefaultMinimumSize
static const QSizeF DefaultMinimumSize
Definition: umlwidget.h:45
QGraphicsSceneMouseEvent::modifiers
Qt::KeyboardModifiers modifiers() const
WidgetBase::fillColor
QColor fillColor() const
Returns fill color.
Definition: widgetbase.cpp:279
Settings::optionState
OptionState & optionState()
Definition: optionstate.cpp:25
QListIterator::next
const T & next()
WidgetBase::wt_Datatype
Definition: widgetbase.h:48
UMLScene::createAutoAttributeAssociations
void createAutoAttributeAssociations(UMLWidget *widget)
If the m_Type of the given widget is WidgetBase::wt_Class then iterate through the class' attributes ...
Definition: umlscene.cpp:2417
WidgetBase::wt_Actor
Definition: widgetbase.h:44
UMLApp::listView
UMLListView * listView() const
Returns a pointer to the list view.
Definition: uml.cpp:920
idchangelog.h
WidgetBase::umlDoc
UMLDoc * umlDoc() const
This is shortcut method for UMLApp::app()->document().
Definition: widgetbase.cpp:117
UMLWidget::constrain
virtual void constrain(qreal &width, qreal &height)
Apply possible constraints to the given candidate width and height.
Definition: umlwidget.cpp:681
UMLScene::fillColor
const QColor & fillColor() const
Returns the fill color to use.
Definition: umlscene.cpp:332
UMLWidget::wasSizeChanged
bool wasSizeChanged()
Checks if the size of the widget changed respect to the size that it had when press event was fired...
Definition: umlwidget.cpp:1288
UMLWidget::mouseReleaseEvent
virtual void mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
Handles a mouse release event.
Definition: umlwidget.cpp:546
QDomElement::attribute
QString attribute(const QString &name, const QString &defValue) const
umlview.h
UMLWidget::showPropertiesDialog
virtual void showPropertiesDialog()
Show a properties dialog for a UMLWidget.
Definition: umlwidget.cpp:1136
QGraphicsScene::items
QList< QGraphicsItem * > items() const
DocWindow::showDocumentation
void showDocumentation(UMLObject *object, bool overwrite=false)
Called when a widget wishes to display its documentation in the doc window.
Definition: docwindow.cpp:88
FloatingTextWidget::textRole
Uml::TextRole::Enum textRole() const
Return the role of the text widget.
Definition: floatingtextwidget.cpp:379
UMLWidget::m_fixedAspectRatio
bool m_fixedAspectRatio
Definition: umlwidget.h:310
WidgetBase
Common base class for UMLWidget and AssociationWidget.
Definition: widgetbase.h:35
Uml::CmdChangeTextColor
Definition: cmd_changeTextColor.h:22
QFont
IDChangeLog
This class contains all the ID translations done for each UMLObject pasted.
Definition: idchangelog.h:26
umlscene.h
QGraphicsItem::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
UMLWidget::m_minimumSize
QSizeF m_minimumSize
Definition: umlwidget.h:299
UMLWidget::DefaultMaximumSize
static const QSizeF DefaultMaximumSize
Definition: umlwidget.h:46
Uml::CmdMoveWidget
Definition: cmd_moveWidget.h:22
UMLDoc::writeToStatusBar
void writeToStatusBar(const QString &text)
Write text to the status bar.
Definition: umldoc.cpp:948
WidgetBase::m_usesDiagramUseFillColor
bool m_usesDiagramUseFillColor
Definition: widgetbase.h:187
WidgetBase::m_lineWidth
uint m_lineWidth
Width of the lines of the widget. Is saved to XMI.
Definition: widgetbase.h:176
WidgetBase::umlScene
UMLScene * umlScene() const
Deliver a pointer to the connected UMLView (needed esp.
Definition: widgetbase.cpp:107
QRectF::size
QSizeF size() const
ListPopupMenu::MenuType
MenuType
< This type hosts all possible menu types.
Definition: listpopupmenu.h:47
UMLWidget::FT_NORMAL
Definition: umlwidget.h:215
UMLApp::app
static UMLApp * app()
Get the last created instance of this class.
Definition: uml.cpp:214
UMLWidget::setSelectionBounds
void setSelectionBounds()
Fills m_selectedWidgetsList and sets the selection bounds ((m_min/m_max)X/Y attributes).
Definition: umlwidget.cpp:1307
QPointer
WidgetBase::m_font
QFont m_font
Definition: widgetbase.h:175
QFont::setUnderline
void setUnderline(bool enable)
Uml::CmdChangeFont
Definition: cmd_changeFont.h:22
QWidget::y
int y() const
UMLWidget::setTextColorCmd
void setTextColorCmd(const QColor &color)
Overrides the method from WidgetBase.
Definition: umlwidget.cpp:895
UMLWidget::slotLineWidthChanged
virtual void slotLineWidthChanged(Uml::ID::Type viewID)
Captures a linewidth change signal.
Definition: umlwidget.cpp:857
UMLWidget::setSelected
virtual void setSelected(bool _select)
Sets the state of whether the widget is selected.
Definition: umlwidget.cpp:1321
UMLWidget::setLineColorCmd
void setLineColorCmd(const QColor &color)
Overrides the method from WidgetBase.
Definition: umlwidget.cpp:915
UMLWidget::setSize
void setSize(qreal width, qreal height)
Sets the size.
Definition: umlwidget.cpp:1523
QObject::metaObject
virtual const QMetaObject * metaObject() const
DocWindow::updateDocumentation
void updateDocumentation(bool clear=false, bool startup=false)
Call when you wish move changes in the doc window back into the members documentation.
Definition: docwindow.cpp:230
WidgetBase::contextMenuEvent
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Reimplemented to show appropriate context menu.
Definition: widgetbase.cpp:694
WidgetBase::textColor
QColor textColor() const
Returns text color.
Definition: widgetbase.cpp:237
QPainter::drawPolygon
void drawPolygon(const QPointF *points, int pointCount, Qt::FillRule fillRule)
UMLWidget::moveByLocal
void moveByLocal(qreal dx, qreal dy)
Move the widget by an X and Y offset relative to the current position.
Definition: umlwidget.cpp:1155
UMLWidget::m_ignoreSnapComponentSizeToGrid
bool m_ignoreSnapComponentSizeToGrid
Definition: umlwidget.h:309
WidgetBase::saveToXMI
virtual void saveToXMI(QDomDocument &qDoc, QDomElement &qElement)
A virtual method to save the properties of this widget into a QDomElement i.e xml.
Definition: widgetbase.cpp:477
QBrush
UMLWidget::height
qreal height() const
Returns the height of widget.
Definition: umlwidget.h:114
QGraphicsItem
QGraphicsSceneMouseEvent::scenePos
QPointF scenePos() const
UMLWidget::UMLWidget
UMLWidget(UMLScene *scene, WidgetType type=wt_UMLWidget, UMLObject *o=0)
Creates a UMLWidget object.
Definition: umlwidget.cpp:59
QPoint
QFontMetrics
UMLScene::optionState
const Settings::OptionState & optionState() const
Returns the options being used.
Definition: umlscene.cpp:428
WidgetBase::loadFromXMI
virtual bool loadFromXMI(QDomElement &qElement)
A virtual method to load the properties of this widget from a QDomElement into this widget...
Definition: widgetbase.cpp:517
UMLWidget::FT_ITALIC_UNDERLINE
Definition: umlwidget.h:221
WidgetBase::WidgetType
WidgetType
Definition: widgetbase.h:41
WidgetBase::wt_Interface
Definition: widgetbase.h:47
WidgetBase::boundingRect
virtual QRectF boundingRect() const
Definition: widgetbase.cpp:640
QPainter::drawLine
void drawLine(const QLineF &line)
QGraphicsView::scene
QGraphicsScene * scene() const
UMLScene::textColor
const QColor & textColor() const
Returns the text color to use.
Definition: umlscene.cpp:389
classifier.h
WidgetBase::id
Uml::ID::Type id() const
Read property of m_nId.
Definition: widgetbase.cpp:159
UMLApp::document
UMLDoc * document() const
Returns a pointer to the current document connected to the KMainWindow instance.
Definition: uml.cpp:910
QGraphicsItem::scene
QGraphicsScene * scene() const
QObject::disconnect
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
WidgetBase::m_baseType
WidgetType m_baseType
Type of widget.
Definition: widgetbase.h:157
UMLWidget::m_inResizeArea
bool m_inResizeArea
Definition: umlwidget.h:332
UMLWidget::m_nPosX
int m_nPosX
Definition: umlwidget.h:295
WidgetBase::name
QString name() const
Gets the name from the corresponding UMLObject if this widget has an underlying UMLObject; if it does...
Definition: widgetbase.cpp:211
UMLWidget::m_oldH
qreal m_oldH
Definition: umlwidget.h:323
DEBUG_REGISTER_DISABLED
#define DEBUG_REGISTER_DISABLED(src)
Definition: debug_utils.h:114
WidgetBase::wt_Component
Definition: widgetbase.h:59
WidgetBase::useFillColor
bool useFillColor()
Return state of fill color usage.
Definition: widgetbase.cpp:321
debug_utils.h
QGraphicsItem::update
void update(const QRectF &rect)
UMLWidget::wasPositionChanged
bool wasPositionChanged()
Checks if the position of the widget changed respect to the position that it had when press event was...
Definition: umlwidget.cpp:1299
WidgetBase::setFillColor
virtual void setFillColor(const QColor &color)
Sets the fill color.
Definition: widgetbase.cpp:289
UMLWidget::setSelectedFlag
void setSelectedFlag(bool _select)
Definition: umlwidget.cpp:1311
Settings::OptionState
Definition: optionstate.h:142
UMLWidget::slotMenuSelection
virtual void slotMenuSelection(QAction *action)
This is usually called synchronously after menu.exec() and trigger's parent is always the ListPopupMe...
Definition: umlwidget.cpp:772
QGraphicsObject::y
y
UMLWidget::m_oldPos
QPointF m_oldPos
The X/Y position the widget had when the movement started.
Definition: umlwidget.h:320
UMLObject
This class is the non-graphical version of UMLWidget.
Definition: umlobject.h:41
QPointF
AssociationWidget
This class represents an association inside a diagram.
Definition: associationwidget.h:50
WidgetBase::m_umlObject
UMLObject * m_umlObject
Definition: widgetbase.h:159
UMLDoc::loading
bool loading() const
Returns true when loading a document file.
Definition: umldoc.cpp:1244
QWidget::width
int width() const
QFont::setBold
void setBold(bool enable)
WidgetBase::setLineColor
virtual void setLineColor(const QColor &color)
Sets the line color.
Definition: widgetbase.cpp:268
Settings::UIState::fillColor
QColor fillColor
Definition: optionstate.h:53
UMLScene::snapX
int snapX() const
Returns the x grid size.
Definition: umlscene.cpp:3378
docwindow.h
Uml::TextRole::Seq_Message
Definition: basictypes.h:160
QWidget::size
QSize size() const
QPainter::drawRect
void drawRect(const QRectF &rectangle)
Uml::CmdChangeLineColor
Definition: cmd_changeLineColor.h:22
settingsdialog.h
QGraphicsItem::zValue
qreal zValue() const
QPainter::setFont
void setFont(const QFont &font)
UMLWidget::resize
void resize()
Resize widget to minimum size.
Definition: umlwidget.cpp:1236
QGraphicsItem::pos
QPointF pos() const
UMLScene::type
Uml::DiagramType::Enum type() const
Returns the type of the diagram.
Definition: umlscene.cpp:284
Uml::DiagramType::Sequence
Definition: basictypes.h:79
QApplication::font
QFont font()
classpropertiesdialog.h
QList::count
int count(const T &value) const
UMLWidget::widgetWithID
virtual UMLWidget * widgetWithID(Uml::ID::Type id)
Returns the widget with the given ID.
Definition: umlwidget.cpp:219
WidgetBase::m_usesDiagramFillColor
bool m_usesDiagramFillColor
Definition: widgetbase.h:186
QPointF::x
qreal x() const
QPointF::y
qreal y() const
QList::append
void append(const T &value)
UMLWidget::isActivated
bool isActivated() const
Returns true if the Activate method has been called for this instance.
Definition: umlwidget.cpp:1046
UMLScene::snapComponentSizeToGrid
bool snapComponentSizeToGrid() const
Return whether to use snap to grid for component size.
Definition: umlscene.cpp:3360
UMLScene::selectedAssocs
AssociationWidgetList selectedAssocs()
Returns a list with all the selected associations from the diagram.
Definition: umlscene.cpp:1866
UMLWidget::m_doc
UMLDoc * m_doc
shortcut for UMLApp::app()->getDocument()
Definition: umlwidget.h:296
UMLWidget::m_activated
bool m_activated
true if the activate function has been called for this class instance
Definition: umlwidget.h:303
UMLApp::docWindow
DocWindow * docWindow() const
Returns the doc window used.
Definition: uml.cpp:1748
listpopupmenu.h
WidgetBase::m_fillColor
QColor m_fillColor
color of the background of the widget
Definition: widgetbase.h:173
QWidget::x
int x() const
UMLWidget::updateWidget
virtual void updateWidget()
When a widget changes this slot captures that signal.
Definition: umlwidget.cpp:655
WidgetBase::wt_Enum
Definition: widgetbase.h:49
ClassPropertiesDialog
Definition: classpropertiesdialog.h:34
UMLWidget::mouseDoubleClickEvent
virtual void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event)
Event handler for mouse double click events.
Definition: umlwidget.cpp:593
UMLWidget::forceUpdateFontMetrics
void forceUpdateFontMetrics(QPainter *painter)
Updates font metrics for widgets current m_font.
Definition: umlwidget.cpp:1747
UMLWidget::setTextColor
virtual void setTextColor(const QColor &color)
Overrides the method from WidgetBase.
Definition: umlwidget.cpp:904
UMLWidget::contextMenuEvent
virtual void contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
Event handler for context menu events.
Definition: umlwidget.cpp:273
QGraphicsView::event
virtual bool event(QEvent *event)
WidgetBase::wt_Class
Definition: widgetbase.h:46
UMLWidget::setFillColor
virtual void setFillColor(const QColor &color)
Sets the background fill color.
Definition: umlwidget.cpp:955
QPainter::setPen
void setPen(const QColor &color)
UMLApp::executeCommand
void executeCommand(QUndoCommand *cmd)
Execute a command and push it in the stack.
Definition: uml.cpp:3227
QDomElement::setAttribute
void setAttribute(const QString &name, const QString &value)
QGraphicsSceneMouseEvent
QGraphicsItem::isSelected
bool isSelected() const
UMLWidget::localID
Uml::ID::Type localID() const
Returns the local ID for this object.
Definition: umlwidget.cpp:202
UMLWidget::m_startMovePostion
QPointF m_startMovePostion
Definition: umlwidget.h:293
UMLWidget::m_shiftPressed
bool m_shiftPressed
If shift or control button were pressed in mouse press event.
Definition: umlwidget.h:326
UMLWidget::m_startResizeSize
QSizeF m_startResizeSize
Definition: umlwidget.h:294
WidgetBase::setLineWidth
virtual void setLineWidth(uint width)
Sets the line width.
Definition: widgetbase.cpp:310
QString::toInt
int toInt(bool *ok, int base) const
umlwidget.h
UMLWidget::selectSingle
void selectSingle(QGraphicsSceneMouseEvent *me)
Selects the widget and clears the other selected widgets, if any.
Definition: umlwidget.cpp:1373
UMLScene::resizeSelection
void resizeSelection()
resize selected widgets
Definition: umlscene.cpp:1480
QPainter
UMLWidget::activate
virtual bool activate(IDChangeLog *ChangeLog=0)
Activate the object after serializing it from a QDataStream.
Definition: umlwidget.cpp:979
QString::isEmpty
bool isEmpty() const
UMLWidget::setLineWidthCmd
void setLineWidthCmd(uint width)
Overrides the method from WidgetBase.
Definition: umlwidget.cpp:944
QList::removeAll
int removeAll(const T &value)
AssociationWidget::moveEntireAssoc
void moveEntireAssoc(qreal x, qreal y)
Moves the entire association by the given offset.
Definition: associationwidget.cpp:3861
UMLWidget::m_pFontMetrics
QFontMetrics * m_pFontMetrics[FT_INVALID]
Definition: umlwidget.h:298
WidgetBase::slotMenuSelection
virtual void slotMenuSelection(QAction *trigger)
This is usually called synchronously after menu.exec() and trigger's parent is always the ListPopupMe...
Definition: widgetbase.cpp:757
UMLScene::widgetAt
UMLWidget * widgetAt(const QPointF &p)
Tests the given point against all widgets and returns the widget for which the point is within its bo...
Definition: umlscene.cpp:1007
WidgetBase::setUseFillColor
virtual void setUseFillColor(bool state)
Set state if fill color is used.
Definition: widgetbase.cpp:331
Settings::ClassState::showStereoType
bool showStereoType
Definition: optionstate.h:66
UMLWidget::setActivated
void setActivated(bool active=true)
Set the m_activated flag of a widget but does not perform the Activate method.
Definition: umlwidget.cpp:1056
WidgetBase::m_usesDiagramLineColor
bool m_usesDiagramLineColor
Definition: widgetbase.h:185
UMLWidget::FT_ITALIC
Definition: umlwidget.h:217
UMLWidget::setFontMetrics
void setFontMetrics(UMLWidget::FontType fontType, QFontMetrics fm)
Set the font metric to use.
Definition: umlwidget.cpp:1709
UMLWidget::minimumSize
virtual QSizeF minimumSize() const
Compute the minimum possible width and height.
Definition: umlwidget.cpp:233
WidgetBase::wt_Text
Definition: widgetbase.h:56
UMLApp::beginMacro
void beginMacro(const QString &text)
Begin a U/R command macro.
Definition: uml.cpp:3245
UMLWidget::isInResizeArea
virtual bool isInResizeArea(QGraphicsSceneMouseEvent *me)
Checks if the mouse is in resize area (right bottom corner), and sets the cursor depending on that...
Definition: umlwidget.cpp:1199
QPainter::setBrush
void setBrush(const QBrush &brush)
UMLWidget::moveEvent
virtual void moveEvent(QGraphicsSceneMouseEvent *event)
Overrides the standard operation.
Definition: umlwidget.cpp:1805
UMLWidget::startMovePosition
QPointF startMovePosition() const
Return the start position of the move action.
Definition: umlwidget.cpp:613
WidgetBase::lineWidth
uint lineWidth() const
Returns line width.
Definition: widgetbase.cpp:300
DEBUG
#define DEBUG(src)
Definition: debug_utils.h:111
Uml::CmdResizeWidget
Definition: cmd_resizeWidget.h:22
UMLWidget::m_showStereotype
bool m_showStereotype
should the stereotype be displayed
Definition: umlwidget.h:287
UMLWidget::m_oldW
qreal m_oldW
The width/height the widget had when the resize started.
Definition: umlwidget.h:323
Tracer::instance
static Tracer * instance()
Definition: debug_utils.cpp:32
QGraphicsSceneContextMenuEvent
QGraphicsSceneMouseEvent::button
Qt::MouseButton button() const
UMLWidget::setMaximumSize
void setMaximumSize(const QSizeF &size)
This method is used to set the maximum size variable for this widget.
Definition: umlwidget.cpp:265
UMLWidget::m_ignoreSnapToGrid
bool m_ignoreSnapToGrid
Change Widget Behaviour.
Definition: umlwidget.h:308
WidgetBase::wt_Artifact
Definition: widgetbase.h:60
QString
UMLWidget::loadFromXMI
virtual bool loadFromXMI(QDomElement &qElement)
A virtual method to load the properties of this widget from a QDomElement into this widget...
Definition: umlwidget.cpp:1833
QList
QGraphicsObject::x
x
UMLWidget::setLineWidth
virtual void setLineWidth(uint width)
Overrides the method from WidgetBase, execute CmdChangeLineWidth.
Definition: umlwidget.cpp:934
QColor
UMLListView::findItem
UMLListViewItem * findItem(Uml::ID::Type id)
Searches through the tree for the item with the given ID.
Definition: umllistview.cpp:1362
UMLWidget::calculateSize
virtual QSizeF calculateSize(bool withExtensions=true) const
calculate content related size of widget.
Definition: umlwidget.cpp:1227
WidgetBase::rect
QRectF rect() const
return drawing rectangle of widget in local coordinates
Definition: widgetbase.cpp:611
UMLDoc::setModified
void setModified(bool modified=true)
Sets the modified flag for the document after a modifying action on the view connected to the documen...
Definition: umldoc.cpp:2652
UMLWidget::m_startMove
bool m_startMove
Definition: umlwidget.h:292
UMLWidget::slotFillColorChanged
virtual void slotFillColorChanged(Uml::ID::Type viewID)
Captures a color change signal.
Definition: umlwidget.cpp:805
UMLScene::selectedWidgets
UMLWidgetList selectedWidgets() const
Returns a list of selected widgets.
Definition: umlscene.cpp:1285
UMLWidget::FT_INVALID
Definition: umlwidget.h:223
Settings::OptionState::uiState
UIState uiState
Definition: optionstate.h:144
UMLWidget::cleanup
virtual void cleanup()
Used to cleanup any other widget it may need to delete.
Definition: umlwidget.cpp:1461
UMLApp::endMacro
void endMacro()
End an U/R command macro.
Definition: uml.cpp:3261
UMLWidget::getIgnoreSnapToGrid
bool getIgnoreSnapToGrid() const
Return the value of m_ignoreSnapToGrid.
Definition: umlwidget.cpp:1513
Uml::ID::Type
std::string Type
Definition: basictypes.h:325
QWidget::font
const QFont & font() const
QDomDocument
UMLWidget::updateGeometry
void updateGeometry()
Update the size of this widget.
Definition: umlwidget.cpp:1552
QList::contains
bool contains(const T &value) const
UMLWidget::FT_BOLD
Definition: umlwidget.h:216
QFont::setItalic
void setItalic(bool enable)
WidgetBase::m_lineColor
QColor m_lineColor
Color of the lines of the widget. Is saved to XMI.
Definition: widgetbase.h:172
UMLWidget::setLineColor
virtual void setLineColor(const QColor &color)
Overrides the method from WidgetBase.
Definition: umlwidget.cpp:924
UMLScene::createAutoConstraintAssociations
void createAutoConstraintAssociations(UMLWidget *widget)
Definition: umlscene.cpp:2548
QTreeWidget::setCurrentItem
void setCurrentItem(QTreeWidgetItem *item)
associationwidget.h
Uml::ID::toString
QString toString(const ID::Type &id)
Definition: basictypes.cpp:1132
Uml::CmdChangeUseFillColor
Definition: cmd_changeUseFillColor.h:21
UMLDoc::findObjectById
UMLObject * findObjectById(Uml::ID::Type id)
Used to find a reference to a UMLObject by its ID.
Definition: umldoc.cpp:782
UMLWidget::~UMLWidget
virtual ~UMLWidget()
Destructor.
Definition: umlwidget.cpp:92
QGraphicsItem::isEnabled
bool isEnabled() const
QGraphicsItem::isVisible
bool isVisible() const
cmds.h
WidgetBase::m_nId
Uml::ID::Type m_nId
This ID is only used when the widget does not have a corresponding UMLObject (i.e.
Definition: widgetbase.h:169
UMLWidget::adjustUnselectedAssocs
void adjustUnselectedAssocs(qreal dx, qreal dy)
Adjusts all unselected associations with the given co-ordinates.
Definition: umlwidget.cpp:1119
UMLWidget::saveToXMI
virtual void saveToXMI(QDomDocument &qDoc, QDomElement &qElement)
A virtual method to save the properties of this widget into a QDomElement i.e xml.
Definition: umlwidget.cpp:1810
WidgetBase::setFont
virtual void setFont(const QFont &font)
Set the font used to display text inside this widget.
Definition: widgetbase.cpp:453
umldoc.h
UMLScene::snapY
int snapY() const
Returns the y grid size.
Definition: umlscene.cpp:3386
UMLWidget::removeAssoc
void removeAssoc(AssociationWidget *pAssoc)
Removes an already created association from the list of associations that include this UMLWidget...
Definition: umlwidget.cpp:1076
QPainter::drawPath
void drawPath(const QPainterPath &path)
Uml::CmdChangeFillColor
Definition: cmd_changeFillColor.h:24
UMLWidget::slotSnapToGrid
void slotSnapToGrid()
Tells the widget to snap to grid.
Definition: umlwidget.cpp:1469
QSizeF
UMLWidget::FT_BOLD_UNDERLINE
Definition: umlwidget.h:220
WidgetBase::wt_Entity
Definition: widgetbase.h:50
UMLScene::activeView
UMLView * activeView() const
Returns the active view associated with this scene.
Definition: umlscene.cpp:206
QLatin1String
ListPopupMenu::mt_Resize
Definition: listpopupmenu.h:215
FloatingTextWidget
Displays a line of text or an operation.
Definition: floatingtextwidget.h:36
UMLWidget::startResizeSize
QSizeF startResizeSize() const
Return the start size of the resize action.
Definition: umlwidget.cpp:631
QRectF
UMLScene::clearSelected
void clearSelected()
Clear the selected widgets list.
Definition: umlscene.cpp:1301
QPainter::fontMetrics
QFontMetrics fontMetrics() const
WidgetBase::baseTypeStr
QLatin1String baseTypeStr() const
Definition: widgetbase.cpp:88
QString::toFloat
float toFloat(bool *ok) const
UMLWidget::deselect
void deselect(QGraphicsSceneMouseEvent *me)
Deselects the widget and removes it from the list of selected widgets.
Definition: umlwidget.cpp:1399
UMLWidget::showStereotype
bool showStereotype() const
Returns the status of whether to show Stereotype.
Definition: umlwidget.cpp:1795
QAction
UMLWidget::setFillColorCmd
void setFillColorCmd(const QColor &color)
Sets the background fill color.
Definition: umlwidget.cpp:967
UMLWidget::operator=
UMLWidget & operator=(const UMLWidget &other)
Assignment operator.
Definition: umlwidget.cpp:100
UMLWidget::m_instanceName
QString m_instanceName
instance name (used if on a deployment diagram)
Definition: umlwidget.h:285
QGraphicsItem::shape
virtual QPainterPath shape() const
UMLWidget::mousePressEvent
virtual void mousePressEvent(QGraphicsSceneMouseEvent *event)
Handles a mouse press event.
Definition: umlwidget.cpp:378
UMLWidget::setFont
virtual void setFont(const QFont &font)
Sets the font the widget is to use.
Definition: umlwidget.cpp:1720
floatingtextwidget.h
WidgetBase::baseType
WidgetType baseType() const
Read property of m_baseType.
Definition: widgetbase.cpp:80
WidgetBase::setSelected
virtual void setSelected(bool select)
Definition: widgetbase.cpp:98
UMLWidget::moveWidgetBy
virtual void moveWidgetBy(qreal diffX, qreal diffY)
Moves the widget to a new position using the difference between the current position and the new posi...
Definition: umlwidget.cpp:295
UMLWidget::addAssoc
void addAssoc(AssociationWidget *pAssoc)
Adds an already created association to the list of associations that include this UMLWidget...
Definition: umlwidget.cpp:1065
UMLWidget::setPenFromSettings
void setPenFromSettings(QPainter &p)
Set the pen.
Definition: umlwidget.cpp:1167
UMLScene::getPaste
bool getPaste() const
Returns the status on whether in a paste state.
Definition: umlscene.cpp:2834
UMLWidget::resizeWidget
virtual void resizeWidget(qreal newW, qreal newH)
Resizes the widget.
Definition: umlwidget.cpp:647
UMLWidget::width
qreal width() const
Returns the width of the widget.
Definition: umlwidget.h:121
umllistview.h
WidgetBase::wt_Message
Definition: widgetbase.h:55
uError
#define uError()
Definition: debug_utils.h:106
UMLWidget::setX
virtual void setX(qreal x)
Sets the x-coordinate.
Definition: umlwidget.cpp:1440
QGraphicsItem::setX
void setX(qreal x)
QGraphicsItem::setY
void setY(qreal y)
UMLWidget::setupFontType
void setupFontType(QFont &font, UMLWidget::FontType fontType)
Definition: umlwidget.cpp:1589
UMLWidget::clipSize
void clipSize()
clip the size of this widget against the minimal and maximal limits.
Definition: umlwidget.cpp:1572
UMLWidget::FT_BOLD_ITALIC
Definition: umlwidget.h:219
WidgetBase::wt_UseCase
Definition: widgetbase.h:45
QPen
UMLWidget::setShowStereotype
virtual void setShowStereotype(bool flag)
Set the status of whether to show Stereotype.
Definition: umlwidget.cpp:1783
UMLWidget::setUseFillColor
virtual void setUseFillColor(bool fc)
Set the status of using fill color (undo action)
Definition: umlwidget.cpp:874
QStyleOptionGraphicsItem
UMLScene::snappedY
qreal snappedY(qreal y)
Returns the input coordinate with possible grid-snap applied.
Definition: umlscene.cpp:3420
UMLWidget::setUseFillColorCmd
void setUseFillColorCmd(bool fc)
Set the status of using fill color.
Definition: umlwidget.cpp:886
uniqueid.h
QListIterator
UMLScene::lineColor
const QColor & lineColor() const
Returns the line color to use.
Definition: umlscene.cpp:351
WidgetBase::setRect
void setRect(const QRectF &rect)
set widget rectangle in item coordinates
Definition: widgetbase.cpp:619
UMLScene::createAutoAssociations
void createAutoAssociations(UMLWidget *widget)
Creates automatically any Associations that the given UMLWidget may have on any diagram.
Definition: umlscene.cpp:2234
UMLWidget::maximumSize
virtual QSizeF maximumSize()
Compute the maximum possible width and height.
Definition: umlwidget.cpp:254
WidgetBase::wt_Object
Definition: widgetbase.h:52
UMLWidget::m_isInstance
bool m_isInstance
holds whether this widget is a component instance (i.e. on a deployment diagram)
Definition: umlwidget.h:286
WidgetBase::m_useFillColor
bool m_useFillColor
flag indicates if the UMLWidget uses the Diagram FillColour
Definition: widgetbase.h:177
UMLWidget::adjustAssocs
virtual void adjustAssocs(qreal dx, qreal dy)
Adjusts associations with the given co-ordinates.
Definition: umlwidget.cpp:1089
UMLScene::getPastePoint
QPointF getPastePoint()
Returns the offset point at which to place the paste from clipboard.
Definition: umlscene.cpp:3163
UMLWidget::m_oldStatusBarMsg
QString m_oldStatusBarMsg
The text in the status bar when the cursor was pressed.
Definition: umlwidget.h:313
UMLWidget::FontType
FontType
Definition: umlwidget.h:214
ListPopupMenu::typeFromAction
static MenuType typeFromAction(QAction *action)
Convenience method to extract the ListPopupMenu type from an action.
Definition: listpopupmenu.cpp:1234
UMLWidget::m_nLocalID
Uml::ID::Type m_nLocalID
Definition: umlwidget.h:291
UMLWidget::setY
virtual void setY(qreal y)
Sets the y-coordinate.
Definition: umlwidget.cpp:1452
Uml::ID::fromString
ID::Type fromString(const QString &id)
Definition: basictypes.cpp:1137
UMLWidget::m_Assocs
AssociationWidgetList m_Assocs
A list of AssociationWidgets between the UMLWidget and other UMLWidgets in the diagram.
Definition: umlwidget.h:283
WidgetBase::wt_Node
Definition: widgetbase.h:61
QSizeF::height
qreal height() const
UMLWidget::constrainMovementForAllWidgets
virtual void constrainMovementForAllWidgets(qreal &diffX, qreal &diffY)
Modifies the value of the diffX and diffY variables used to move the widgets.
Definition: umlwidget.cpp:318
UMLWidget::setFontCmd
void setFontCmd(const QFont &font)
Sets the font the widget is to use.
Definition: umlwidget.cpp:1735
QAbstractItemView::clearSelection
void clearSelection()
UMLWidget::FT_BOLD_ITALIC_UNDERLINE
Definition: umlwidget.h:222
UMLWidget::m_moved
bool m_moved
If the widget was selected/moved/resized in the press and release cycle.
Definition: umlwidget.h:339
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
UMLWidget::m_maximumSize
QSizeF m_maximumSize
Definition: umlwidget.h:300
AssociationWidget::widgetMoved
void widgetMoved(UMLWidget *widget, qreal x, qreal y)
Adjusts the ending point of the association that connects to Widget.
Definition: associationwidget.cpp:1914
UMLWidget::getFontMetrics
QFontMetrics & getFontMetrics(UMLWidget::FontType fontType) const
Returns the font metric used by this object for Text which uses bold/italic fonts.
Definition: umlwidget.cpp:1701
QDomElement
WidgetBase::operator=
WidgetBase & operator=(const WidgetBase &other)
Assignment operator.
Definition: widgetbase.cpp:584
QCursor
QBrush::setColor
void setColor(const QColor &color)
Settings::OptionState::classState
ClassState classState
Definition: optionstate.h:145
QGraphicsItem::setZValue
void setZValue(qreal z)
Uml::ID::None
const Type None
special value for uninitialized ID
Definition: basictypes.h:327
UMLWidget::setMinimumSize
void setMinimumSize(const QSizeF &size)
This method is used to set the minimum size variable for this widget.
Definition: umlwidget.cpp:244
WidgetBase::font
virtual QFont font() const
Returns the font used for diaplaying any text.
Definition: widgetbase.cpp:445
AssociationWidget::saveIdealTextPositions
void saveIdealTextPositions()
Auxiliary method for widgetMoved(): Saves all ideally computed floatingtext positions before doing an...
Definition: associationwidget.cpp:1900
WidgetBase::setTextColor
virtual void setTextColor(const QColor &color)
Sets the text color.
Definition: widgetbase.cpp:247
QGraphicsItem::scenePos
QPointF scenePos() const
QSizeF::width
qreal width() const
QWidget::height
int height() const
UMLApp::statusBarMsg
QString statusBarMsg()
Returns the current text in the status bar.
Definition: uml.cpp:3168
UMLScene
UMLScene instances represent diagrams.
Definition: umlscene.h:68
WidgetBase::lineColor
QColor lineColor() const
Returns line color.
Definition: widgetbase.cpp:258
QGraphicsSceneMouseEvent::lastScenePos
QPointF lastScenePos() const
WidgetBase::wt_Port
Definition: widgetbase.h:72
uml.h
WidgetBase::m_scene
UMLScene * m_scene
Definition: widgetbase.h:158
DBG_SRC
#define DBG_SRC
Definition: import_utils.cpp:43
UMLWidget::slotWidgetMoved
virtual void slotWidgetMoved(Uml::ID::Type id)
Captures when another widget moves if this widget is linked to it.
Definition: umlwidget.cpp:796
UMLWidget::operator==
bool operator==(const UMLWidget &other) const
Overload '==' operator.
Definition: umlwidget.cpp:137
UMLScene::ID
Uml::ID::Type ID() const
Returns the ID of the diagram.
Definition: umlscene.cpp:300
QPolygonF
WidgetBase::hasDocumentation
bool hasDocumentation()
Returns state of documentation for the widget.
Definition: widgetbase.cpp:183
UMLWidget::setDefaultFontMetrics
virtual void setDefaultFontMetrics(QFont &font, UMLWidget::FontType fontType)
Template Method, override this to set the default font metric.
Definition: umlwidget.cpp:1583
Uml::CmdChangeLineWidth
Definition: cmd_changeLineWidth.h:20
UMLObject::id
virtual Uml::ID::Type id() const
Returns the ID of the object.
Definition: umlobject.cpp:390
QListIterator::hasNext
bool hasNext() const
UMLWidget
This is the base class for nearly all graphical widgets.
Definition: umlwidget.h:38
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:40:27 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

umbrello/umbrello

Skip menu "umbrello/umbrello"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdesdk API Reference

Skip menu "kdesdk API Reference"
  • kapptemplate
  • kcachegrind
  • kompare
  • lokalize
  • umbrello
  •   umbrello

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal