diff -r 790e3eff9980 -r b1e3a4d88f13 linkablemapobj.cpp --- a/linkablemapobj.cpp Mon Mar 27 20:21:57 2006 +0000 +++ b/linkablemapobj.cpp Tue Sep 05 10:03:29 2006 +0000 @@ -5,6 +5,8 @@ #include "mapeditor.h" #include "version.h" +//Added by qt3to4: +#include ///////////////////////////////////////////////////////////////// @@ -17,7 +19,7 @@ init (); } -LinkableMapObj::LinkableMapObj(QCanvas* c) :MapObj(c) +LinkableMapObj::LinkableMapObj(Q3Canvas* c) :MapObj(c) { // cout << "Const LinkableMapObj\n"; init (); @@ -77,15 +79,15 @@ linkpos=LinkBottom; segment.setAutoDelete (TRUE); arcsegs=13; - QPointArray pa(arcsegs*2+2); + Q3PointArray pa(arcsegs*2+2); - bottomline=new QCanvasLine(canvas); + bottomline=new Q3CanvasLine(canvas); bottomline->setPen( QPen(linkcolor, 1) ); bottomline->setZ(Z_LINK); bottomline->show(); // Prepare showing the selection of a MapObj - selbox = new QCanvasRectangle (canvas); + selbox = new Q3CanvasRectangle (canvas); selbox->setZ(Z_SELBOX); selbox->setBrush( QColor(255,255,0) ); selbox->setPen( QPen(QColor(255,255,0) )); @@ -152,8 +154,7 @@ { if (parObj) { - relPos.setX (absPos.x() - parObj->getChildPos().x() ); - relPos.setY (absPos.y() - parObj->getChildPos().y() ); + relPos=getRelPos(); parObj->calcBBoxSize(); parObj->requestReposition(); @@ -169,6 +170,14 @@ } } +QPoint LinkableMapObj::getRelPos() +{ + if (!parObj) return QPoint(); + relPos.setX (absPos.x() - parObj->getChildPos().x() ); + relPos.setY (absPos.y() - parObj->getChildPos().y() ); + return relPos; +} + int LinkableMapObj::getTopPad() { return topPad; @@ -225,14 +234,14 @@ if (childObj!=NULL && parObj != NULL) { int i; - QCanvasLine* cl; + Q3CanvasLine* cl; switch (style) { case StyleUndef: bottomline->hide(); break; case StyleLine: - l = new QCanvasLine(canvas); + l = new Q3CanvasLine(canvas); l->setPen( QPen(linkcolor, 1) ); l->setZ(Z_LINK); if (visible) @@ -243,7 +252,7 @@ case StyleParabel: for (i=0;isetPen( QPen(linkcolor, 1) ); cl->setPoints( 0,0,i*10,100); cl->setZ(Z_LINK); @@ -256,7 +265,7 @@ pa0.resize (arcsegs+1); break; case StylePolyLine: - p = new QCanvasPolygon(canvas); + p = new Q3CanvasPolygon(canvas); p->setBrush( linkcolor ); p->setZ(Z_LINK); if (visible) @@ -266,7 +275,7 @@ pa0.resize (3); // TODO a bit awkward: draw the lines additionally to polygon, to avoid // missing pixels, when polygon is extremly flat - l = new QCanvasLine(canvas); + l = new Q3CanvasLine(canvas); l->setPen( QPen(linkcolor, 1) ); l->setZ(Z_LINK); if (visible) @@ -275,7 +284,7 @@ l->hide(); break; case StylePolyParabel: - p = new QCanvasPolygon(canvas); + p = new Q3CanvasPolygon(canvas); p->setBrush( linkcolor ); p->setZ(Z_LINK); if (visible) @@ -291,7 +300,7 @@ // if polygon is extremly flat for (i=0;isetPen( QPen(linkcolor, 1) ); cl->setPoints( 0,0,i*10,100); cl->setZ(Z_LINK); @@ -348,7 +357,7 @@ { linkcolor=col; bottomline->setPen( QPen(linkcolor, 1) ); - QCanvasLine *cl; + Q3CanvasLine *cl; switch (style) { case StyleLine: @@ -400,7 +409,7 @@ void LinkableMapObj::setVisibility (bool v) { - QCanvasLine* cl; + Q3CanvasLine* cl; MapObj::setVisibility (v); bool visnow=visible; @@ -550,7 +559,7 @@ // "turning point" for drawing polygonal links QPoint tp (-qRound(sin (a)*thickness_start), qRound(cos (a)*thickness_start)); - QCanvasLine *cl; + Q3CanvasLine *cl; int i; @@ -663,21 +672,6 @@ return parPos; } -QPoint LinkableMapObj::getRelPos() -{ - return relPos; -/* FIXME not needed? relPos was moved in 1.7.10 from - floatobj to linkablemapobj. Before we had: - - if (!parObj) return QPoint (0,0); - return QPoint( - absPos.x() - parObj->x(), - absPos.y() - parObj->y() - ); -*/ -} - - void LinkableMapObj::setUseOrientation (const bool &b) { if (useOrientation!=b) @@ -802,7 +796,7 @@ setVisibility (visible); } -void LinkableMapObj::parabel (QPointArray &ya, double p1x, double p1y, double p2x, double p2y) +void LinkableMapObj::parabel (Q3PointArray &ya, double p1x, double p1y, double p2x, double p2y) { double vx=p2x - p1x; // V=P2-P1