48 painter->setRenderHint( QPainter::Antialiasing );
49 painter->setPen(
mPen );
50 painter->setBrush(
mBrush );
52 painter->translate( rect().width() / 2.0, rect().height() / 2.0 );
56 double halfPenWidth =
mPen.widthF() / 2.0;
68 triangle << QPointF( halfPenWidth,
mShapeHeight - halfPenWidth );
70 triangle << QPointF(
mShapeWidth / 2.0, halfPenWidth );
71 painter->drawPolygon( triangle );
86 QDomElement composerShapeElem = doc.createElement(
"ComposerShape" );
87 composerShapeElem.setAttribute(
"shapeType",
mShape );
88 composerShapeElem.setAttribute(
"outlineWidth",
mPen.widthF() );
89 composerShapeElem.setAttribute(
"transparentFill",
mBrush.style() == Qt::NoBrush );
90 composerShapeElem.setAttribute(
"shapeWidth",
mShapeWidth );
91 composerShapeElem.setAttribute(
"shapeHeight",
mShapeHeight );
92 QDomElement outlineColorElem = doc.createElement(
"OutlineColor" );
93 outlineColorElem.setAttribute(
"red",
mPen.color().red() );
94 outlineColorElem.setAttribute(
"green",
mPen.color().green() );
95 outlineColorElem.setAttribute(
"blue",
mPen.color().blue() );
96 outlineColorElem.setAttribute(
"alpha",
mPen.color().alpha() );
97 composerShapeElem.appendChild( outlineColorElem );
98 QDomElement fillColorElem = doc.createElement(
"FillColor" );
99 fillColorElem.setAttribute(
"red",
mBrush.color().red() );
100 fillColorElem.setAttribute(
"green",
mBrush.color().green() );
101 fillColorElem.setAttribute(
"blue",
mBrush.color().blue() );
102 fillColorElem.setAttribute(
"alpha",
mBrush.color().alpha() );
103 composerShapeElem.appendChild( fillColorElem );
104 elem.appendChild( composerShapeElem );
105 return _writeXML( composerShapeElem, doc );
111 mShapeWidth = itemElem.attribute(
"shapeWidth",
"10" ).toDouble();
112 mShapeHeight = itemElem.attribute(
"shapeHeight",
"10" ).toDouble();
113 mPen.setWidthF( itemElem.attribute(
"outlineWidth",
"0.4" ).toDouble() );
116 bool transparent = itemElem.attribute(
"transparentFill",
"1" ).toInt() == 1;
119 mBrush.setStyle( Qt::NoBrush );
123 mBrush.setStyle( Qt::SolidPattern );
127 QDomNodeList outlineColorList = itemElem.elementsByTagName(
"OutlineColor" );
128 if ( outlineColorList.size() > 0 )
130 QDomElement outlineColorElem = outlineColorList.at( 0 ).toElement();
131 int penRed = outlineColorElem.attribute(
"red",
"0" ).toInt();
132 int penGreen = outlineColorElem.attribute(
"green",
"0" ).toInt();
133 int penBlue = outlineColorElem.attribute(
"blue",
"0" ).toInt();
134 int penAlpha = outlineColorElem.attribute(
"alpha",
"255" ).toInt();
135 mPen.setColor( QColor( penRed, penGreen, penBlue, penAlpha ) );
139 QDomNodeList fillNodeList = itemElem.elementsByTagName(
"FillColor" );
140 if ( fillNodeList.size() > 0 )
142 QDomElement fillColorElem = fillNodeList.at( 0 ).toElement();
143 int brushRed = fillColorElem.attribute(
"red",
"0" ).toInt();
144 int brushGreen = fillColorElem.attribute(
"green",
"0" ).toInt();
145 int brushBlue = fillColorElem.attribute(
"blue",
"0" ).toInt();
146 int brushAlpha = fillColorElem.attribute(
"alpha",
"255" ).toInt();
147 mBrush.setColor( QColor( brushRed, brushGreen, brushBlue, brushAlpha ) );
152 QDomNodeList composerItemList = itemElem.elementsByTagName(
"ComposerItem" );
153 if ( composerItemList.size() > 0 )
155 QDomElement composerItemElem = composerItemList.at( 0 ).toElement();
164 mPen.setWidthF( width );
169 return mPen.widthF();
174 mPen.setColor( color );
194 return mBrush.style() == Qt::NoBrush;
201 mBrush.setStyle( Qt::NoBrush );
205 mBrush.setStyle( Qt::SolidPattern );
211 mPen.setColor( QColor( 0, 0, 0 ) );
213 mPen.setJoinStyle( Qt::RoundJoin );
214 mBrush.setColor( QColor( 0, 0, 0 ) );
215 mBrush.setStyle( Qt::NoBrush );
218 setPen( QPen( QColor( 255, 255, 255, 0 ) ) );
219 setBrush( QBrush( QColor( 255, 255, 255, 0 ) ) );
230 double x = transform().dx() + rect().width() / 2.0 - width / 2.0;
231 double y = transform().dy() + rect().height() / 2.0 - height / 2.0;
242 if ( rectangle.width() != rect().width() || rectangle.height() != rect().height() )
244 double newShapeWidth = rectangle.width();
245 double newShapeHeight = rectangle.height();