linkablemapobj.h
changeset 408 c2a05fa925a1
parent 406 1c8ff1928b97
child 442 dfbc371b7280
     1.1 --- a/linkablemapobj.h	Thu Nov 23 16:18:26 2006 +0000
     1.2 +++ b/linkablemapobj.h	Fri Dec 08 20:18:56 2006 +0000
     1.3 @@ -5,8 +5,7 @@
     1.4  #include "noteobj.h"
     1.5  #include "headingobj.h"
     1.6  #include "flagrowobj.h"
     1.7 -//Added by qt3to4:
     1.8 -#include <Q3PointArray>
     1.9 +
    1.10  
    1.11  #define MAX_DEPTH 999
    1.12  
    1.13 @@ -25,7 +24,7 @@
    1.14  	Q_OBJECT
    1.15  public:
    1.16      LinkableMapObj ();
    1.17 -    LinkableMapObj (Q3Canvas*);
    1.18 +    LinkableMapObj (QGraphicsScene*);
    1.19      LinkableMapObj (LinkableMapObj*);
    1.20      ~LinkableMapObj ();
    1.21  	virtual void delLink();
    1.22 @@ -33,20 +32,20 @@
    1.23      virtual void copy (LinkableMapObj*);
    1.24      void setChildObj (LinkableMapObj*);
    1.25      virtual void setParObj (LinkableMapObj*);
    1.26 -    virtual void setParObjTmp (LinkableMapObj*,QPoint,int);	// Only for moving Obj around
    1.27 +    virtual void setParObjTmp (LinkableMapObj*,QPointF,int);	// Only for moving Obj around
    1.28  	virtual void unsetParObjTmp();						// reuse original ParObj
    1.29  	virtual bool hasParObjTmp();
    1.30  
    1.31  	virtual void setUseRelPos (const bool&);
    1.32  	virtual void setRelPos();				// set relPos to current parentPos
    1.33 -	virtual void setRelPos(const QPoint&);	
    1.34 -	virtual QPoint getRelPos();
    1.35 +	virtual void setRelPos(const QPointF&);	
    1.36 +	virtual QPointF getRelPos();
    1.37  	virtual void setUseOrientation (const bool &);
    1.38  
    1.39  
    1.40 -	virtual int getTopPad();
    1.41 -	virtual int getLeftPad();
    1.42 -	virtual int getRightPad();
    1.43 +	virtual qreal getTopPad();
    1.44 +	virtual qreal getLeftPad();
    1.45 +	virtual qreal getRightPad();
    1.46  	LinkStyle getDefLinkStyle();
    1.47      void setLinkStyle(LinkStyle);            
    1.48  	LinkStyle getLinkStyle();
    1.49 @@ -70,71 +69,72 @@
    1.50      LinkableMapObj* getParObj();			// returns pointer to toObj
    1.51      virtual LinkableMapObj* findObjBySelect(QString s);	// find obj by selectstring
    1.52  	virtual void setDockPos()=0;				// sets childPos and parPos
    1.53 -    QPoint getChildPos();					// returns pos where childs dock
    1.54 -    QPoint getParPos();						// returns pos where parents dock
    1.55 +    QPointF getChildPos();					// returns pos where childs dock
    1.56 +    QPointF getParPos();						// returns pos where parents dock
    1.57      LinkOrient getOrientation();			// get orientation
    1.58      virtual int getDepth();					// return depth
    1.59  	virtual void setMapEditor(MapEditor*);	// set MapEditor (needed in LMO::updateNoteFlag)
    1.60  	virtual MapEditor* getMapEditor();		// get MapEditor (usually from parent);
    1.61 -	virtual QPoint getRandPos();			// make randomised position
    1.62 +	virtual QPointF getRandPos();			// make randomised position
    1.63  
    1.64 -    //virtual void alignRelativeTo(const QPoint );
    1.65 +    //virtual void alignRelativeTo(const QPointF );
    1.66  	virtual void reposition();
    1.67  	virtual void requestReposition();		// do reposition after next user event
    1.68  	virtual void forceReposition();			// to force a reposition now (outside
    1.69  											// of mapeditor e.g. in noteeditor
    1.70  	virtual bool repositionRequested();
    1.71  
    1.72 -	//virtual QRect getTotalBBox();			// return BBox including childs			
    1.73 -	//virtual QRect getBBoxSizeWithChilds();// return size of BBox including childs  
    1.74 +	//virtual QRectF getTotalBBox();			// return BBox including childs			
    1.75 +	//virtual QRectF getBBoxSizeWithChilds();// return size of BBox including childs  
    1.76  	virtual void calcBBoxSizeWithChilds()=0;// calc size of  BBox including childs recursivly
    1.77  
    1.78  	virtual void setSelBox();
    1.79      virtual void select();
    1.80      virtual void unselect();
    1.81  	virtual	QString getSelectString()=0;
    1.82 -	//virtual QString saveToDir (const QString&,const QString&, const QPoint&);// Save data to XML
    1.83 +	//virtual QString saveToDir (const QString&,const QString&, const QPointF&);// Save data to XML
    1.84  
    1.85  protected:
    1.86 -	void parabel(Q3PointArray &,double,double,double,double);	// Create Parabel connecting two points
    1.87 +	void parabel(QPolygonF &,double,double,double,double);	// Create Parabel connecting two points
    1.88  	QString getLinkAttr();
    1.89  
    1.90 -    QPoint childPos;
    1.91 -    QPoint parPos;
    1.92 +    QPointF childPos;
    1.93 +    QPointF parPos;
    1.94  	bool link2ParPos;				// While moving around, sometimes link to parent
    1.95  	MapEditor* mapEditor;			// for updateNoteFlag() and toggleScroll()
    1.96      LinkOrient orientation;     
    1.97 -    int linkwidth;					// width of a link
    1.98 +    qreal linkwidth;				// width of a link
    1.99      int depth;						// depth: undef=-1 mapCenter=0 branch=1..n
   1.100 -	QRect bboxTotal;				// bounding box including childs
   1.101 +	QRectF bboxTotal;				// bounding box including childs
   1.102  
   1.103      LinkableMapObj* childObj;
   1.104      LinkableMapObj* parObj;
   1.105      LinkableMapObj* parObjTmpBuf;	// temporary buffer the original parent
   1.106 -    int bottomlineY;                // vertical offset of dockpos to pos
   1.107 +    qreal bottomlineY;              // vertical offset of dockpos to pos
   1.108  
   1.109  	int thickness_start;			// for StylePoly*	
   1.110      LinkStyle style;				// Current style
   1.111  	LinkPos linkpos;				// Link at bottom of object or middle of height
   1.112      QColor linkcolor;               // Link color
   1.113 -    Q3CanvasLine* l;                 // line style
   1.114 -	Q3CanvasPolygon* p;				// poly styles
   1.115 +	QPen pen;
   1.116 +    QGraphicsLineItem* l;           // line style
   1.117 +	QGraphicsPolygonItem* p;		// poly styles
   1.118      int arcsegs;                    // arc: number of segments
   1.119 -    QList <Q3CanvasLine*> segment; // a part of e.g. the parabel
   1.120 -	Q3PointArray pa0;				// For drawing of PolyParabel and PolyLine
   1.121 -	Q3PointArray pa1;				// For drawing of PolyParabel 
   1.122 -	Q3PointArray pa2;				// For drawing of PolyParabel	
   1.123 -    Q3CanvasLine* bottomline;        // on bottom of BBox
   1.124 +    QList <QGraphicsLineItem*> segment; // a part of e.g. the parabel
   1.125 +	QPolygonF pa0;					// For drawing of PolyParabel and PolyLine
   1.126 +	QPolygonF pa1;					// For drawing of PolyParabel 
   1.127 +	QPolygonF pa2;					// For drawing of PolyParabel	
   1.128 +    QGraphicsLineItem* bottomline;  // on bottom of BBox
   1.129  	bool repositionRequest;			// 
   1.130  
   1.131  	bool selected;					// Used for marking the selection
   1.132  	bool hideLinkUnselected;		// to hide links if unselected
   1.133 -	Q3CanvasRectangle* selbox;
   1.134 +	QGraphicsRectItem* selbox;
   1.135  	FrameObj *frame;				// frame around object
   1.136 -	int topPad, botPad,
   1.137 +	qreal topPad, botPad,
   1.138  		leftPad, rightPad;          // padding within bbox
   1.139  
   1.140 -	QPoint relPos;					// position relative to childPos of parent
   1.141 +	QPointF relPos;					// position relative to childPos of parent
   1.142  	bool useRelPos;
   1.143  	bool useOrientation;
   1.144  };