# HG changeset patch # User insilmaril # Date 1177516974 0 # Node ID 80ae7b79828c581f43922a4917bf40458ef7ce3f # Parent e21e3b8c312cbb61555358277e58ef28a0cddb68 started doxygen documentation diff -r e21e3b8c312c -r 80ae7b79828c floatobj.cpp --- a/floatobj.cpp Wed Apr 25 16:02:54 2007 +0000 +++ b/floatobj.cpp Wed Apr 25 16:02:54 2007 +0000 @@ -40,7 +40,7 @@ setChildObj(this); floatExport=true; zPlane=Z_ICON; - setLinkStyle (StyleParabel); + setLinkStyle (LinkableMapObj::Parabel); setHideLinkUnselected(true); } diff -r e21e3b8c312c -r 80ae7b79828c floatobj.h --- a/floatobj.h Wed Apr 25 16:02:54 2007 +0000 +++ b/floatobj.h Wed Apr 25 16:02:54 2007 +0000 @@ -3,6 +3,9 @@ #include "ornamentedobj.h" +/*! \brief Base class for objects floating in the map, which means they can be positioned freely. */ + + ///////////////////////////////////////////////////////////////////////////// class FloatObj:public OrnamentedObj { public: diff -r e21e3b8c312c -r 80ae7b79828c frameobj.cpp --- a/frameobj.cpp Wed Apr 25 16:02:54 2007 +0000 +++ b/frameobj.cpp Wed Apr 25 16:02:54 2007 +0000 @@ -25,7 +25,8 @@ void FrameObj::init() { type=NoFrame; - border=0; + padding=10; + borderWidth=1; penColor=QColor (Qt::black); brushColor=QColor (Qt::white); } @@ -44,7 +45,7 @@ break; } type=NoFrame; - border=0; + padding=0; } void FrameObj::move(double x, double y) @@ -93,12 +94,32 @@ } } -int FrameObj::getBorder() +void FrameObj::setPadding (const int &i) { - return border; + padding=i; + repaint(); } -FrameType FrameObj::getFrameType() +int FrameObj::getPadding() +{ + if (type==NoFrame) + return 0; + else + return padding; +} + +void FrameObj::setBorderWidth (const int &i) +{ + borderWidth=i; + repaint(); +} + +int FrameObj::getBorderWidth() +{ + return borderWidth; +} + +FrameObj::FrameType FrameObj::getFrameType() { return type; } @@ -127,16 +148,13 @@ switch (type) { case NoFrame: - border=0; break; case Rectangle: - border=10; rectFrame = scene->addRect(QRectF(0,0,0,0), QPen(penColor), brushColor); rectFrame->setZValue(Z_FRAME); rectFrame->show(); break; case Ellipse: - border=10; ellipseFrame = scene->addEllipse(QRectF(0,0,0,0), QPen(penColor), brushColor); ellipseFrame->setZValue(Z_FRAME); ellipseFrame->show(); @@ -180,15 +198,19 @@ void FrameObj::repaint() { + QPen pen; + pen.setColor (penColor); + pen.setWidth (borderWidth); + QBrush brush (brushColor); switch (type) { case Rectangle: - rectFrame->setPen (penColor); - rectFrame->setBrush (brushColor); + rectFrame->setPen (pen); + rectFrame->setBrush (brush); break; case Ellipse: - ellipseFrame->setPen (penColor); - ellipseFrame->setBrush (brushColor); + ellipseFrame->setPen (pen); + ellipseFrame->setBrush (brush); break; default: break; @@ -220,9 +242,17 @@ QString FrameObj::saveToDir () { + if (type==NoFrame) return QString(); QString frameTypeAttr=attribut ("frameType",getFrameTypeName()); QString penColAttr=attribut ("penColor",penColor.name() ); QString brushColAttr=attribut ("brushColor",brushColor.name() ); - return singleElement ("frame",frameTypeAttr + penColAttr + brushColAttr); + QString paddingAttr=attribut ("padding",QString::number (padding) ); + QString borderWidthAttr=attribut ("borderWidth",QString::number (borderWidth) ); + return singleElement ( + "frame",frameTypeAttr + + penColAttr + + brushColAttr + + paddingAttr + + borderWidthAttr); } diff -r e21e3b8c312c -r 80ae7b79828c frameobj.h --- a/frameobj.h Wed Apr 25 16:02:54 2007 +0000 +++ b/frameobj.h Wed Apr 25 16:02:54 2007 +0000 @@ -3,10 +3,16 @@ #include "mapobj.h" -enum FrameType {NoFrame,Rectangle,Ellipse}; + +/*! \brief This class adds a frame to a MapObj. +*/ class FrameObj:public MapObj { public: + + /*! \brief Supported frame types */ + enum FrameType {NoFrame,Rectangle,Ellipse}; + FrameObj(); FrameObj(QGraphicsScene*); ~FrameObj(); @@ -17,7 +23,10 @@ void positionBBox(); void calcBBoxSize(); void setRect (const QRectF &); // set dimensions - int getBorder(); + void setPadding(const int &); + int getPadding(); + void setBorderWidth (const int &); + int getBorderWidth (); FrameType getFrameType (); QString getFrameTypeName (); void setFrameType (const FrameType &); @@ -31,10 +40,11 @@ QString saveToDir (); private: - FrameType type; + FrameType type; //!< Frame type QGraphicsRectItem * rectFrame; QGraphicsEllipseItem * ellipseFrame; - int border; // distance text - frame + int padding; // distance text - frame + int borderWidth; QColor penColor; QColor brushColor; };