[Uml-devel] KDE/kdesdk/umbrello/umbrello
Ralf Habacker
ralf.habacker at gmail.com
Sun Mar 18 18:35:21 UTC 2012
SVN commit 1286219 by habacker:
Derived UMLScene... classes from the related Q3Canvas... classes.
Removed also Q3Canvas* parameter from constructor in preparation
for QGraphicsScene requirements.
CCBUG: 290952
M +2 -1 toolbarstatearrow.cpp
M +2 -1 toolbarstateassociation.cpp
M +4 -2 toolbarstatemessages.cpp
M +46 -4 umlscene.h
M +23 -13 widgets/associationline.cpp
M +2 -2 widgets/associationline.h
M +4 -2 widgets/associationwidget.cpp
M +6 -3 widgets/seqlinewidget.cpp
M +4 -2 widgets/umlwidget.cpp
M +2 -1 widgets/widget_utils.cpp
--- trunk/KDE/kdesdk/umbrello/umbrello/toolbarstatearrow.cpp #1286218:1286219
@@ -84,7 +84,8 @@
m_startPosition = m_pMouseEvent->pos();
for (int i = 0; i < 4; i++) {
- UMLSceneLineItem* line = new UMLSceneLineItem(m_pUMLScene->canvas());
+ UMLSceneLineItem* line = new UMLSceneLineItem;
+ line->setCanvas((m_pUMLScene->canvas()));
line->setPoints(m_pMouseEvent->x(), m_pMouseEvent->y(),
m_pMouseEvent->x(), m_pMouseEvent->y());
line->setPen(QPen(QColor("grey"), 0, Qt::DotLine));
--- trunk/KDE/kdesdk/umbrello/umbrello/toolbarstateassociation.cpp #1286218:1286219
@@ -186,7 +186,8 @@
m_firstWidget = widget;
- m_associationLine = new UMLSceneLineItem(m_pUMLScene->canvas());
+ m_associationLine = new UMLSceneLineItem;
+ m_associationLine->setCanvas(m_pUMLScene->canvas());
m_associationLine->setPoints(pos.x(), pos.y(), pos.x(), pos.y());
m_associationLine->setPen(QPen(m_pUMLScene->lineColor(), m_pUMLScene->lineWidth(), Qt::DashLine));
--- trunk/KDE/kdesdk/umbrello/umbrello/toolbarstatemessages.cpp #1286218:1286219
@@ -198,7 +198,8 @@
xclick = m_pMouseEvent->x();
yclick = m_pMouseEvent->y();
- m_messageLine = new UMLSceneLineItem(m_pUMLScene->canvas());
+ m_messageLine = new UMLSceneLineItem;
+ m_messageLine->setCanvas(m_pUMLScene->canvas());
m_messageLine->setPoints(m_pMouseEvent->x(), m_pMouseEvent->y(), m_pMouseEvent->x(), m_pMouseEvent->y());
m_messageLine->setPen(QPen(m_pUMLScene->lineColor(), m_pUMLScene->lineWidth(), Qt::DashLine));
@@ -241,7 +242,8 @@
UMLApp::app()->document()->setModified();
}
else {
- m_messageLine = new UMLSceneLineItem(m_pUMLScene->canvas());
+ m_messageLine = new UMLSceneLineItem;
+ m_messageLine->setCanvas(m_pUMLScene->canvas());
m_messageLine->setPoints(m_pMouseEvent->x(), m_pMouseEvent->y(), m_pMouseEvent->x(), m_pMouseEvent->y());
m_messageLine->setPen(QPen(m_pUMLScene->lineColor(), m_pUMLScene->lineWidth(), Qt::DashLine));
--- trunk/KDE/kdesdk/umbrello/umbrello/umlscene.h #1286218:1286219
@@ -43,11 +43,7 @@
typedef QContextMenuEvent UMLSceneContextMenuEvent;
//typedef QDragDropEvent UMLSceneDragDropEvent;
-typedef Q3CanvasLine UMLSceneLineItem;
-typedef Q3CanvasRectangle UMLSceneRectItem;
typedef Q3CanvasItem UMLSceneItem;
-typedef Q3CanvasPolygon UMLScenePolygonItem;
-typedef Q3CanvasEllipse UMLSceneEllipseItem;
typedef Q3CanvasItemList UMLSceneItemList;
/**
@@ -64,4 +60,50 @@
UMLScenePoint scenePos() { return pos(); }
};
+class UMLSceneLineItem : public Q3CanvasLine
+{
+public:
+ UMLSceneLineItem()
+ : Q3CanvasLine(0)
+ {
+ }
+};
+
+class UMLSceneRectItem : public Q3CanvasRectangle
+{
+public:
+ UMLSceneRectItem()
+ : Q3CanvasRectangle(0)
+ {
+ }
+
+ UMLSceneRectItem(int x, int y, int w, int h)
+ : Q3CanvasRectangle(x, y, w, h, 0)
+ {
+ }
+};
+
+class UMLScenePolygonItem : public Q3CanvasPolygon
+{
+public:
+ UMLScenePolygonItem()
+ : Q3CanvasPolygon(0)
+ {
+ }
+};
+
+class UMLSceneEllipseItem : public Q3CanvasEllipse
+{
+public:
+ UMLSceneEllipseItem()
+ : Q3CanvasEllipse(0)
+ {
+ }
+
+ UMLSceneEllipseItem(int width, int height)
+ : Q3CanvasEllipse(width, height, 0)
+ {
+ }
+};
+
#endif
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/associationline.cpp #1286218:1286219
@@ -28,8 +28,8 @@
#include "umldoc.h"
#include "uml.h"
-AssociationLine::Circle::Circle(UMLViewCanvas * canvas, int radius /* = 0 */)
- : UMLSceneEllipseItem(radius * 2, radius * 2, canvas)
+AssociationLine::Circle::Circle(int radius /* = 0 */)
+ : UMLSceneEllipseItem(radius * 2, radius * 2)
{
}
@@ -60,8 +60,9 @@
p.drawEllipse( (int)x() - radius, (int)y() - radius, diameter, diameter);
}
-AssociationLine::SubsetSymbol::SubsetSymbol(UMLViewCanvas* canvas)
- : UMLSceneEllipseItem(canvas) {
+AssociationLine::SubsetSymbol::SubsetSymbol()
+ : UMLSceneEllipseItem()
+{
inclination = 0;
}
@@ -189,7 +190,8 @@
QPoint sp = first->startPoint();
QPoint ep = first->endPoint();
first->setPoints( sp.x(), sp.y(), point.x(), point.y() );
- UMLSceneLineItem * line = new UMLSceneLineItem( getScene() );
+ UMLSceneLineItem * line = new UMLSceneLineItem;
+ line->setCanvas(getScene());
line->setZ( -2 );
line->setPoints( point.x(), point.y(), ep.x(), ep.y() );
line->setPen( pen() );
@@ -204,7 +206,8 @@
QPoint sp = before->startPoint();
QPoint ep = before->endPoint();
before->setPoints( sp.x(), sp.y(), point.x(), point.y() );
- UMLSceneLineItem * line = new UMLSceneLineItem( getScene() );
+ UMLSceneLineItem * line = new UMLSceneLineItem;
+ line->setCanvas(getScene());
line->setPoints( point.x(), point.y(), ep.x(), ep.y() );
line->setZ( -2 );
line->setPen( pen() );
@@ -218,7 +221,8 @@
QPoint sp = before->startPoint();
QPoint ep = before->endPoint();
before->setPoints( sp.x(), sp.y(), point.x(), point.y() );
- UMLSceneLineItem * line = new UMLSceneLineItem(getScene() );
+ UMLSceneLineItem * line = new UMLSceneLineItem;
+ line->setCanvas(getScene());
line->setPoints( point.x(), point.y(), ep.x(), ep.y() );
line->setZ( -2 );
line->setPen( pen() );
@@ -395,7 +399,8 @@
{
int count = m_LineList.count();
if( count == 0 ) {
- UMLSceneLineItem * line = new UMLSceneLineItem(getScene() );
+ UMLSceneLineItem * line = new UMLSceneLineItem;
+ line->setCanvas(getScene());
line->setPoints( start.x(), start.y(),end.x(),end.y() );
line->setZ( -2 );
line->setPen( pen() );
@@ -982,7 +987,8 @@
case Uml::AssociationType::Generalization:
case Uml::AssociationType::Realization:
growList(m_HeadList, 3);
- m_pClearPoly = new UMLScenePolygonItem( canvas );
+ m_pClearPoly = new UMLScenePolygonItem;
+ m_pClearPoly->setCanvas(canvas);
m_pClearPoly->setVisible( true );
m_pClearPoly->setBrush( QBrush( Qt::white ) );
m_pClearPoly->setZ( -1 );
@@ -991,7 +997,8 @@
case Uml::AssociationType::Composition:
case Uml::AssociationType::Aggregation:
growList(m_HeadList, 4);
- m_pClearPoly = new UMLScenePolygonItem( canvas );
+ m_pClearPoly = new UMLScenePolygonItem;
+ m_pClearPoly->setCanvas(canvas);
m_pClearPoly->setVisible( true );
if( getAssocType() == Uml::AssociationType::Aggregation )
m_pClearPoly->setBrush( QBrush( Qt::white ) );
@@ -1003,7 +1010,8 @@
case Uml::AssociationType::Containment:
growList(m_HeadList, 1);
if (!m_pCircle) {
- m_pCircle = new Circle( canvas, 6 );
+ m_pCircle = new Circle( 6 );
+ m_pCircle->setCanvas( canvas );
m_pCircle->show();
m_pCircle->setPen( QPen( lineColor(), lineWidth() ) );
}
@@ -1200,7 +1208,8 @@
switch( getAssocType() ) {
case Uml::AssociationType::Child2Category:
- m_pSubsetSymbol = new SubsetSymbol(getScene());
+ m_pSubsetSymbol = new SubsetSymbol;
+ m_pSubsetSymbol->setCanvas(getScene());
m_pSubsetSymbol->setPen( QPen( lineColor(), lineWidth() ) );
updateSubsetSymbol();
m_pSubsetSymbol->show();
@@ -1264,7 +1273,8 @@
{
QPen pen( lineColor(), lineWidth() );
for (int i = 0; i < by; i++) {
- UMLSceneLineItem * line = new UMLSceneLineItem( getScene() );
+ UMLSceneLineItem * line = new UMLSceneLineItem;
+ line->setCanvas(getScene());
line->setZ( 0 );
line->setPen( pen );
line->setVisible( true );
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/associationline.h #1286218:1286219
@@ -115,7 +115,7 @@
class Circle : public UMLSceneEllipseItem
{
public:
- explicit Circle(UMLViewCanvas * canvas, int radius = 0);
+ explicit Circle(int radius = 0);
void setRadius(int radius);
int getRadius() const;
void setX(int x);
@@ -130,7 +130,7 @@
class SubsetSymbol : public UMLSceneEllipseItem
{
public:
- explicit SubsetSymbol(UMLViewCanvas* canvas);
+ explicit SubsetSymbol();
/**
* Sets the Inclination of the Subset Symbol w.r.t horizontal x axis
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/associationwidget.cpp #1286218:1286219
@@ -2760,8 +2760,10 @@
*/
void AssociationWidget::createAssocClassLine()
{
- if (m_pAssocClassLine == NULL)
- m_pAssocClassLine = new UMLSceneLineItem(m_scene->canvas());
+ if (m_pAssocClassLine == NULL) {
+ m_pAssocClassLine = new UMLSceneLineItem;
+ m_pAssocClassLine ->setCanvas(m_scene->canvas());
+ }
computeAssocClassLine();
QPen pen(lineColor(), lineWidth(), Qt::DashLine);
m_pAssocClassLine->setPen(pen);
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/seqlinewidget.cpp #1286218:1286219
@@ -26,8 +26,9 @@
* Constructor.
*/
SeqLineWidget::SeqLineWidget(UMLView * pView, ObjectWidget * pObject)
- : UMLSceneLineItem( pView -> canvas() )
+ : UMLSceneLineItem()
{
+ setCanvas(pView -> canvas());
m_scene = pView;
m_pObject = pObject;
setPen( QPen( m_pObject->lineColor(), 0, Qt::DashLine ) );
@@ -141,13 +142,15 @@
rect.setWidth( 14 );
rect.setHeight( 14 );
- m_DestructionBox.line1 = new UMLSceneLineItem( m_scene->canvas() );
+ m_DestructionBox.line1 = new UMLSceneLineItem;
+ m_DestructionBox.line1->setCanvas(m_scene->canvas());
m_DestructionBox.setLine1Points(rect);
m_DestructionBox.line1->setVisible( true );
m_DestructionBox.line1->setPen( QPen(m_pObject->lineColor(), 2) );
m_DestructionBox.line1->setZ( 3 );
- m_DestructionBox.line2 = new UMLSceneLineItem( m_scene -> canvas() );
+ m_DestructionBox.line2 = new UMLSceneLineItem;
+ m_DestructionBox.line2->setCanvas(m_scene->canvas());
m_DestructionBox.setLine2Points(rect);
m_DestructionBox.line2->setVisible( true );
m_DestructionBox.line2->setPen( QPen(m_pObject->lineColor(), 2) );
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/umlwidget.cpp #1286218:1286219
@@ -54,8 +54,9 @@
*/
UMLWidget::UMLWidget(UMLScene * scene, WidgetType type, UMLObject * o, UMLWidgetController *widgetController)
: WidgetBase(scene, type),
- UMLSceneRectItem(scene->canvas())
+ UMLSceneRectItem()
{
+ setCanvas(scene->canvas());
if (widgetController) {
m_widgetController = widgetController;
} else {
@@ -79,8 +80,9 @@
*/
UMLWidget::UMLWidget(UMLScene *scene, WidgetType type, Uml::IDType id, UMLWidgetController *widgetController)
: WidgetBase(scene, type),
- UMLSceneRectItem(scene->canvas())
+ UMLSceneRectItem()
{
+ setCanvas(scene->canvas());
if (widgetController) {
m_widgetController = widgetController;
} else {
--- trunk/KDE/kdesdk/umbrello/umbrello/widgets/widget_utils.cpp #1286218:1286219
@@ -56,7 +56,8 @@
UMLSceneRectItem *rect;
rect = new UMLSceneRectItem(p.x() - SIZE / 2,
p.y() - SIZE / 2,
- SIZE, SIZE, currentView->canvas());
+ SIZE, SIZE);
+ rect->setCanvas(currentView->canvas());
rect->setBrush( QBrush(Qt::blue) );
rect->setPen( QPen(Qt::blue) );
rect->setVisible(true);
More information about the umbrello-devel
mailing list