Commit 295cac04 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

krita: Properly handle the cursor for mirror axis handles

parent 78407d41
......@@ -57,6 +57,8 @@ public:
, verticalHandlePosition(0.f)
, sideMargin(10.f)
, minHandlePosition(10.f + 32.f)
, horizontalContainsCursor(false)
, verticalContainsCursor(false)
{ }
void setAxisPosition(float x, float y);
......@@ -81,6 +83,8 @@ public:
float verticalHandlePosition;
float sideMargin;
float minHandlePosition;
bool horizontalContainsCursor;
bool verticalContainsCursor;
};
KisMirrorAxis::KisMirrorAxis(KisCanvasResourceProvider* provider, KisView2* parent)
......@@ -213,12 +217,27 @@ bool KisMirrorAxis::eventFilter(QObject* target, QEvent* event)
event->accept();
return true;
}
if(d->mirrorHorizontal && d->horizontalHandle.contains(me->posF())) {
QApplication::setOverrideCursor(Qt::OpenHandCursor);
} else if(d->mirrorVertical && d->verticalHandle.contains(me->posF())) {
QApplication::setOverrideCursor(Qt::OpenHandCursor);
} else {
QApplication::restoreOverrideCursor();
if(d->mirrorHorizontal) {
if(d->horizontalHandle.contains(me->posF())) {
if(!d->horizontalContainsCursor) {
QApplication::setOverrideCursor(Qt::OpenHandCursor);
d->horizontalContainsCursor = true;
}
} else if(d->horizontalContainsCursor) {
QApplication::restoreOverrideCursor();
d->horizontalContainsCursor = false;
}
}
if(d->mirrorVertical) {
if(d->verticalHandle.contains(me->posF())) {
if(!d->verticalContainsCursor) {
QApplication::setOverrideCursor(Qt::OpenHandCursor);
d->verticalContainsCursor = true;
}
} else if(d->verticalContainsCursor) {
QApplication::restoreOverrideCursor();
d->verticalContainsCursor = false;
}
}
}
if(event->type() == QEvent::MouseButtonRelease) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment