frameobj.cpp
changeset 442 dfbc371b7280
parent 425 7014be3ac7d0
child 470 80ae7b79828c
     1.1 --- a/frameobj.cpp	Sat Mar 31 09:28:27 2007 +0000
     1.2 +++ b/frameobj.cpp	Sat Mar 31 09:28:27 2007 +0000
     1.3 @@ -26,6 +26,8 @@
     1.4  {
     1.5      type=NoFrame;
     1.6      border=0;
     1.7 +	penColor=QColor (Qt::black);
     1.8 +	brushColor=QColor (Qt::white);
     1.9  }
    1.10  
    1.11  void FrameObj::clear()
    1.12 @@ -129,17 +131,19 @@
    1.13  				break;
    1.14  			case Rectangle:
    1.15  				border=10;
    1.16 -				rectFrame = scene->addRect(QRectF(0,0,0,0), QPen(QColor("black") ), QColor("white"));
    1.17 +				rectFrame = scene->addRect(QRectF(0,0,0,0), QPen(penColor), brushColor);
    1.18  				rectFrame->setZValue(Z_FRAME);
    1.19 +				rectFrame->show();
    1.20  				break;
    1.21  			case Ellipse:
    1.22  				border=10;
    1.23 -				ellipseFrame = scene->addEllipse(QRectF(0,0,0,0), QPen(QColor("black") ), QColor("white"));
    1.24 +				ellipseFrame = scene->addEllipse(QRectF(0,0,0,0), QPen(penColor), brushColor);
    1.25  				ellipseFrame->setZValue(Z_FRAME);
    1.26 +				ellipseFrame->show();
    1.27  				break;
    1.28  		}
    1.29 -		setVisibility (visible);
    1.30  	}
    1.31 +	setVisibility (visible);
    1.32  }
    1.33  
    1.34  void FrameObj::setFrameType(const QString &t)
    1.35 @@ -152,6 +156,46 @@
    1.36  		FrameObj::setFrameType (NoFrame);
    1.37  }
    1.38  
    1.39 +void FrameObj::setPenColor (QColor col)
    1.40 +{
    1.41 +	penColor=col;
    1.42 +	repaint();
    1.43 +}
    1.44 +
    1.45 +QColor FrameObj::getPenColor ()
    1.46 +{
    1.47 +	return penColor;
    1.48 +}
    1.49 +
    1.50 +void FrameObj::setBrushColor (QColor col)
    1.51 +{
    1.52 +	brushColor=col;
    1.53 +	repaint();
    1.54 +}
    1.55 +
    1.56 +QColor FrameObj::getBrushColor ()
    1.57 +{
    1.58 +	return brushColor;
    1.59 +}
    1.60 +
    1.61 +void FrameObj::repaint()
    1.62 +{
    1.63 +	switch (type)
    1.64 +	{
    1.65 +		case Rectangle:
    1.66 +			rectFrame->setPen   (penColor);
    1.67 +			rectFrame->setBrush (brushColor);
    1.68 +			break;
    1.69 +		case Ellipse:
    1.70 +			ellipseFrame->setPen   (penColor);
    1.71 +			ellipseFrame->setBrush (brushColor);
    1.72 +			break;
    1.73 +		default:
    1.74 +			break;
    1.75 +	}
    1.76 +}
    1.77 +
    1.78 +
    1.79  void FrameObj::setVisibility (bool v)
    1.80  {
    1.81      MapObj::setVisibility(v);
    1.82 @@ -177,6 +221,8 @@
    1.83  QString FrameObj::saveToDir ()
    1.84  {
    1.85  	QString	frameTypeAttr=attribut ("frameType",getFrameTypeName());
    1.86 -	return singleElement ("frame",frameTypeAttr);
    1.87 +	QString	penColAttr=attribut ("penColor",penColor.name() );
    1.88 +	QString	brushColAttr=attribut ("brushColor",brushColor.name() );
    1.89 +	return singleElement ("frame",frameTypeAttr + penColAttr + brushColAttr);
    1.90  }
    1.91