diff options
Diffstat (limited to 'src/other/swipemodefilter.cpp')
-rw-r--r-- | src/other/swipemodefilter.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/src/other/swipemodefilter.cpp b/src/other/swipemodefilter.cpp index 21cbd83..6d5593d 100644 --- a/src/other/swipemodefilter.cpp +++ b/src/other/swipemodefilter.cpp @@ -60,36 +60,29 @@ bool SwipeModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) case setFirstPoint: mState = updateFirstPoint; mValuePoints.append(new MouseIndicator(ev->pos(), this)); - mValuePoints.last()->setBrush(Qt::red); + mValuePoints[0]->setCursor(Qt::ClosedHandCursor); return true; case setSecondPoint: if (mValuePoints[0]->contains(mapToItem(mValuePoints[0], ev->pos()))) { mState = updateFirstPoint; - if (mValuePoints.length() == 3) - mValuePoints[2]->setVisible(false); + mValuePoints[0]->setCursor(Qt::ClosedHandCursor); } else { mState = updateSecondPoint; mValuePoints.append(new MouseIndicator(ev->pos(), this)); - mValuePoints.last()->setBrush(Qt::red); + mValuePoints[1]->setCursor(Qt::ClosedHandCursor); } return true; break; case setThirdPoint: if (mValuePoints[0]->contains(mapToItem(mValuePoints[0], ev->pos()))) { mState = updateFirstPoint; - if (mValuePoints.length() == 3) - mValuePoints[2]->setVisible(false); + mValuePoints[0]->setCursor(Qt::ClosedHandCursor); } else if (mValuePoints[1]->contains(mapToItem(mValuePoints[1], ev->pos()))) { mState = updateSecondPoint; - if (mValuePoints.length() == 3) - mValuePoints[2]->setVisible(false); + mValuePoints[1]->setCursor(Qt::ClosedHandCursor); } else { - if (mValuePoints.length() == 2) { - mValuePoints.append(new MouseIndicator(ev->pos(), this)); - } else { - mValuePoints[2]->setCenter(ev->pos()); - mValuePoints[2]->setVisible(true); - } + mValuePoints.append(new MouseIndicator(ev->pos(), this)); + mValuePoints[2]->setCursor(Qt::ClosedHandCursor); mDiff1 = ev->pos() - mValuePoints[0]->center(); mDiff2 = ev->pos() - mValuePoints[1]->center(); mValuePoints[0]->setStartPos(mValuePoints[0]->center()); @@ -116,9 +109,11 @@ bool SwipeModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) mState = setSecondPoint; else mState = setThirdPoint; + mValuePoints[0]->setCursor(Qt::OpenHandCursor); return true; case updateSecondPoint: mState = setThirdPoint; + mValuePoints[1]->setCursor(Qt::OpenHandCursor); return true; case updateThirdPoint: touchEvent = createTouchEventFromMouseEvent(widget, ev); @@ -127,7 +122,8 @@ bool SwipeModeFilter::sceneEventFilter(QGraphicsItem *watched, QEvent *event) "dispatchTouchEvent", widget->widgetId, touchEvent); - mState = setThirdPoint; + removeValuePoints(); + mState = setFirstPoint; return true; default: return true; |