aboutsummaryrefslogtreecommitdiff
path: root/stfstrokeitem.cc
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2020-09-12 02:21:04 +0200
committerJavier <dev.git@javispedro.com>2020-09-12 02:21:04 +0200
commitc2eca928c5a7be0444fcb5c41ffe77b557714575 (patch)
treeaf7d2ed9e2b018a4ea95329bb944853f41cf088f /stfstrokeitem.cc
parent20de09ffbaa00ab3adf91e49b847eb0061315b1e (diff)
downloadscribiu-c2eca928c5a7be0444fcb5c41ffe77b557714575.tar.gz
scribiu-c2eca928c5a7be0444fcb5c41ffe77b557714575.zip
when zooming out, place pages on a grid layout
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);
}