diff -r dfbc371b7280 -r 4a84d7e444d8 frameobj.cpp --- a/frameobj.cpp Sat Mar 31 09:28:27 2007 +0000 +++ b/frameobj.cpp Thu Jan 21 11:56:57 2010 +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); }