summaryrefslogtreecommitdiffstats
path: root/qt-ui/profile/ruleritem.cpp
diff options
context:
space:
mode:
authorGravatar Tomaz Canabrava <tomaz.canabrava@intel.com>2014-03-09 10:59:31 -0300
committerGravatar Dirk Hohndel <dirk@hohndel.org>2014-03-09 08:50:54 -0700
commit24c5b2e3c1bda349c208a94cf8c17fa17af971db (patch)
treec54f66a6d36d3d43d74b84e9119fc4c507a36b7e /qt-ui/profile/ruleritem.cpp
parentb6bbfdcc5f1d90d00ccc0244e5e9792558d25abd (diff)
downloadsubsurface-24c5b2e3c1bda349c208a94cf8c17fa17af971db.tar.gz
Code Cleanup ( that fix 2 bugs )
This code cleanup fixes the two issues that I raised on my last e-mail. hurrah. Signed-off-by: Tomaz Canabrava <tomaz.canabrava@intel.com> Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
Diffstat (limited to 'qt-ui/profile/ruleritem.cpp')
-rw-r--r--qt-ui/profile/ruleritem.cpp42
1 files changed, 5 insertions, 37 deletions
diff --git a/qt-ui/profile/ruleritem.cpp b/qt-ui/profile/ruleritem.cpp
index a21a9a04a..99a04438f 100644
--- a/qt-ui/profile/ruleritem.cpp
+++ b/qt-ui/profile/ruleritem.cpp
@@ -16,10 +16,10 @@
RulerNodeItem2::RulerNodeItem2() : entry(NULL), ruler(NULL)
{
memset(&pInfo, 0, sizeof(pInfo));
- setRect(QRect(QPoint(-8, 8), QPoint(8, -8)));
+ setRect(-8, -8, 16, 16);
setBrush(QColor(0xff, 0, 0, 127));
- setPen(QColor("#FF0000"));
- setFlag(QGraphicsItem::ItemIsMovable);
+ setPen(QColor(Qt::red));
+ setFlag(ItemIsMovable);
setFlag(ItemSendsGeometryChanges);
setFlag(ItemIgnoresTransformations);
}
@@ -59,8 +59,7 @@ QVariant RulerNodeItem2::itemChange(GraphicsItemChange change, const QVariant &v
{
if (change == ItemPositionHasChanged) {
recalculate();
- if (ruler != NULL)
- ruler->recalculate();
+ ruler->recalculate();
}
return QGraphicsEllipseItem::itemChange(change, value);
}
@@ -97,7 +96,7 @@ void RulerItem2::recalculate()
startPoint = tmp;
}
QLineF line(startPoint, endPoint);
-
+ setLine(line);
compare_samples(source->entry, dest->entry, buffer, 500, 1);
text = QString(buffer);
@@ -127,37 +126,6 @@ RulerNodeItem2 *RulerItem2::destNode() const
return dest;
}
-void RulerItem2::paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
-{
- Q_UNUSED(option);
- Q_UNUSED(widget);
- QLineF line(startPoint, endPoint);
- painter->setPen(QColor(Qt::black));
- painter->setBrush(Qt::NoBrush);
- painter->drawLine(line);
-}
-
-QRectF RulerItem2::boundingRect() const
-{
- return shape().controlPointRect();
-}
-
-QPainterPath RulerItem2::shape() const
-{
- QPainterPath path;
- QLineF line(startPoint, endPoint);
- QLineF line_n = line.normalVector();
- line_n.setLength(height);
- if (paint_direction == 1)
- line_n.setAngle(line_n.angle() + 180);
- path.moveTo(startPoint);
- path.lineTo(line_n.p2());
- path.lineTo(line_n.p2() + QPointF(line.dx(), line.dy()));
- path.lineTo(endPoint);
- path.lineTo(startPoint);
- return path;
-}
-
void RulerItem2::setPlotInfo(plot_info info)
{
pInfo = info;