summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swift/QtUI/Whiteboard/FreehandLineItem.cpp')
-rw-r--r--Swift/QtUI/Whiteboard/FreehandLineItem.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/Swift/QtUI/Whiteboard/FreehandLineItem.cpp b/Swift/QtUI/Whiteboard/FreehandLineItem.cpp
index 3dc42a7..af8e827 100644
--- a/Swift/QtUI/Whiteboard/FreehandLineItem.cpp
+++ b/Swift/QtUI/Whiteboard/FreehandLineItem.cpp
@@ -18,12 +18,12 @@ namespace Swift {
void FreehandLineItem::paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget)
{
- painter->setPen(_pen);
- if (points.size() > 0) {
- QVector<QPointF>::const_iterator it = points.begin();
+ painter->setPen(pen_);
+ if (points_.size() > 0) {
+ QVector<QPointF>::const_iterator it = points_.begin();
QPointF previous = *it;
++it;
- for (; it != points.end(); ++it) {
+ for (; it != points_.end(); ++it) {
painter->drawLine(previous, *it);
previous = *it;
}
@@ -32,8 +32,8 @@ namespace Swift {
void FreehandLineItem::setStartPoint(QPointF point)
{
- points.clear();
- points.append(point);
+ points_.clear();
+ points_.append(point);
QRectF rect(point, point);
boundRect = rect;
update(rect);
@@ -42,9 +42,9 @@ namespace Swift {
void FreehandLineItem::lineTo(QPointF point)
{
qreal x1, x2, y1, y2;
- x1 = points.last().x();
+ x1 = points_.last().x();
x2 = point.x();
- y1 = points.last().y();
+ y1 = points_.last().y();
y2 = point.y();
if (x1 > x2) {
qreal temp = x1;
@@ -58,7 +58,7 @@ namespace Swift {
}
QRectF rect(x1-1, y1-1, x2+1-x1, y2+1-y1);
- points.append(point);
+ points_.append(point);
boundRect |= rect;
update(rect);
@@ -68,7 +68,7 @@ namespace Swift {
{
QVector<QPointF>::const_iterator it;
QSizeF size(1,1);
- for (it = points.begin(); it != points.end(); ++it) {
+ for (it = points_.begin(); it != points_.end(); ++it) {
if (path.intersects(QRectF(*it, size))) {
return true;
}
@@ -78,11 +78,19 @@ namespace Swift {
void FreehandLineItem::setPen(const QPen& pen)
{
- _pen = pen;
+ pen_ = pen;
}
QPen FreehandLineItem::pen() const
{
- return _pen;
+ return pen_;
+ }
+
+ QVector<QPointF> FreehandLineItem::points() const {
+ return points_;
+ }
+
+ int FreehandLineItem::type() const {
+ return Type;
}
}