Engauge Digitizer  2
 All Classes Files Functions Variables Enumerations Enumerator Friends Pages
GraphicsArcItem.cpp
1 #include "GraphicsArcItem.h"
2 #include <QDebug>
3 #include <QPainter>
4 #include <QGraphicsScene>
5 
7  double y,
8  double width,
9  double height,
10  QGraphicsItem *parent) :
11  QGraphicsEllipseItem(x,
12  y,
13  width,
14  height,
15  parent)
16 {
17 }
18 
20  QGraphicsItem *parent) :
21  QGraphicsEllipseItem (rect,
22  parent)
23 {
24 }
25 
27 {
28  // Untransformed bounding rectangle is worthless since there will be, if there was any shear or rotation,
29  // parts of the curve left after this graphics item is hidden. Trying to compute the actual extent is surprisingly
30  // hard when startAngle, spanAngle, shear and rotation are all considered.
31  //
32  // Since the GraphicsArcItem should ideally have spanned most of the image (for the most accurate digitizing
33  // results), we simply mark the whole image as part of the boundingRect
34  return scene()->sceneRect();
35 }
36 
37 void GraphicsArcItem::paint (QPainter *painter,
38  const QStyleOptionGraphicsItem * /* option */,
39  QWidget * /* widget */)
40 {
41  painter->setPen (pen ());
42  painter->drawArc (rect(),
43  startAngle (),
44  spanAngle());
45 }
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
Paint without interior fill.
GraphicsArcItem(double x, double y, double width, double height, QGraphicsItem *parent=0)
Constructor with individual coordinates.
virtual QRectF boundingRect() const
QGraphicsEllipseItem ignored transformation when computing bounding rectangle, although it should so ...