aboutsummaryrefslogtreecommitdiff
path: root/stfstrokeitem.cc
diff options
context:
space:
mode:
Diffstat (limited to 'stfstrokeitem.cc')
-rw-r--r--stfstrokeitem.cc13
1 files changed, 10 insertions, 3 deletions
diff --git a/stfstrokeitem.cc b/stfstrokeitem.cc
index dbc7ca0..335e166 100644
--- a/stfstrokeitem.cc
+++ b/stfstrokeitem.cc
@@ -29,7 +29,7 @@ StfStrokeItem::StfStrokeItem(const QPainterPath &stroke, const PaperReplay::Sess
_startTime(startTime), _endTime(endTime)
{
QPen pen(Qt::black, 8.0f);
- if (_session.isValid()) {
+ if (hasPaperReplay()) {
pen.setColor(Qt::darkGreen);
setCursor(Qt::PointingHandCursor);
}
@@ -41,16 +41,23 @@ int StfStrokeItem::type() const
return Type;
}
+bool StfStrokeItem::hasPaperReplay() const
+{
+ return _session.isValid() && !_session.fileName().isEmpty();
+}
+
void StfStrokeItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
{
- if (_session.isValid() && !_session.fileName().isEmpty()) {
+ if (event->button() == Qt::LeftButton && hasPaperReplay()) {
QGraphicsView *view = scene()->views().first();
if (NotebookView *nbview = qobject_cast<NotebookView*>(view)) {
- event->accept();
qint64 time = _startTime - _session.startTime();
if (time < 10) time = 0;
nbview->requestPaperReplay(_session.fileName(), time);
+ event->accept();
+ return;
}
}
+ QGraphicsItem::mousePressEvent(event);
}