diff options
author | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-06-02 16:23:59 (GMT) |
---|---|---|
committer | Mateusz Piekos <mateuszpiekos@gmail.com> | 2012-06-02 16:23:59 (GMT) |
commit | 7520c7fed383d4f7631f5572ef40379022126264 (patch) | |
tree | ee87b26bb923d0289a670defce96e2012f3623e3 /Swift/QtUI/Whiteboard/FreehandLineItem.cpp | |
parent | e8ab1af885ff61715ab0350c3cb22ed6988a082a (diff) | |
download | swift-contrib-7520c7fed383d4f7631f5572ef40379022126264.zip swift-contrib-7520c7fed383d4f7631f5572ef40379022126264.tar.bz2 |
Added whiteboard controller with simple sharing
Whiteboard controller is handled in ChatController only for
testing purposes.
Diffstat (limited to 'Swift/QtUI/Whiteboard/FreehandLineItem.cpp')
-rw-r--r-- | Swift/QtUI/Whiteboard/FreehandLineItem.cpp | 32 |
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; } } |