[Uml-devel] KDE/kdesdk/umbrello/umbrello/widgets
Ralf Habacker
ralf.habacker at gmail.com
Fri Dec 16 17:53:28 UTC 2011
SVN commit 1268875 by habacker:
refactored UMLWidget assign operator
- added assign operator to WidgetBase
- let assign WidgetBase it's members
- called WidgetBase assign operator in UMLWidget
- reordered assign operations according to the class definition
M +14 -13 umlwidget.cpp
M +18 -0 widgetbase.cpp
M +2 -0 widgetbase.h
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/umlwidget.cpp #1268874:1268875
@@ -87,38 +87,39 @@
if (this == &other)
return *this;
+ WidgetBase::operator=(other);
+
// assign members loaded/saved
m_useFillColour = other.m_useFillColour;
- m_nId = other.m_nId;
- m_Type = other.m_Type;
- setX(other.getX());
- setY(other.getY());
- m_Assocs = other.m_Assocs;
- m_Font = other.m_Font;
- UMLSceneRectangle::setSize(other.width(), other.height());
m_usesDiagramFillColour = other.m_usesDiagramFillColour;
- m_usesDiagramLineColour = other.m_usesDiagramLineColour;
- m_usesDiagramLineWidth = other.m_usesDiagramLineWidth;
m_usesDiagramUseFillColour = other.m_usesDiagramUseFillColour;
- m_LineColour = other.m_LineColour;
- m_LineWidth = other.m_LineWidth;
m_FillColour = other.m_FillColour;
+ m_Assocs = other.m_Assocs;
+ m_Text = other.m_Text; //new
+ m_Font = other.m_Font;
m_isInstance = other.m_isInstance;
m_instanceName = other.m_instanceName;
+ m_instanceName = other.m_instanceName;
+ m_showStereotype = other.m_showStereotype;
+ setX(other.getX());
+ setY(other.getY());
+ UMLSceneRectangle::setSize(other.width(), other.height());
// assign volatile (non-saved) members
m_selected = other.m_selected;
m_startMove = other.m_startMove;
m_nPosX = other.m_nPosX;
- m_pObject = other.m_pObject;
- m_scene = other.m_scene;
+ m_origZ = other.m_origZ; //new
m_pMenu = other.m_pMenu;
+ m_menuIsEmbedded = other.m_menuIsEmbedded;
+ m_pDoc = other.m_pDoc; //new
m_resizable = other.m_resizable;
for (unsigned i = 0; i < FT_INVALID; ++i)
m_pFontMetrics[i] = other.m_pFontMetrics[i];
m_activated = other.m_activated;
m_ignoreSnapToGrid = other.m_ignoreSnapToGrid;
m_ignoreSnapComponentSizeToGrid = other.m_ignoreSnapComponentSizeToGrid;
+ // m_widgetController do not have any settings
return *this;
}
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/widgetbase.cpp #1268874:1268875
@@ -279,4 +279,22 @@
return true;
}
+/**
+ * Assignment operator
+ */
+WidgetBase& WidgetBase::operator=(const WidgetBase& other)
+{
+ m_Type = other.m_Type;
+ m_scene = other.m_scene;
+ m_pObject = other.m_pObject;
+ m_Doc = other.m_Doc;
+ m_nId = other.m_nId;
+ m_LineColour = other.m_LineColour;
+ m_LineWidth = other.m_LineWidth;
+ m_usesDiagramLineColour = other.m_usesDiagramLineColour;
+ m_usesDiagramLineWidth = other.m_usesDiagramLineWidth;
+
+ return *this;
+}
+
#include "widgetbase.moc"
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/widgetbase.h #1268874:1268875
@@ -101,6 +101,8 @@
virtual bool loadFromXMI( QDomElement & qElement );
virtual void saveToXMI( QDomDocument & qDoc, QDomElement & qElement );
+ WidgetBase& operator=(const WidgetBase& other);
+
protected:
void init(WidgetType type = wt_UMLWidget);
More information about the umbrello-devel
mailing list