I have gone through the scribble example for how to draw free form . i want the same free form draw using QGraphicsitem on qgraphicsview. i should draw it as a graphicsitem as i can move the selected free form every where in the scene. i tried this
void view
::drawLineTo(const QPointF &startPoint,
const QPointF &endPoint
) liner.
setLine( QLineF(startPoint, endPoint
) );
liner.
setPen(QPen(Qt
::red));
path.setFillRule(Qt::WindingFill);
path.addPath( liner.shape() );
path = path.simplified();
DrawnPathItem->setPath(path);
DrawnPathItem = this->scene()->addPath(QPainterPath());
void view::drawLineTo(const QPointF &startPoint, const QPointF &endPoint)
QGraphicsLineItem liner;
liner.setLine( QLineF(startPoint, endPoint) );
liner.setPen(QPen(Qt::red));
QPainterPath path = DrawnPathItem->path();
path.setFillRule(Qt::WindingFill);
path.addPath( liner.shape() );
path = path.simplified();
DrawnPathItem->setPath(path);
To copy to clipboard, switch view to plain text mode
i dont know how to draw as a item on scene .. please help me
Bookmarks