Commit a1edd082 authored by Arjen Hiemstra's avatar Arjen Hiemstra
Browse files

Make "Set Mirror Axis" work properly.

Now you get a target cursor and a click will set the mirror axis.
parent c88cd224
......@@ -24,6 +24,7 @@
#include <KAction>
#include <KLocalizedString>
#include <KActionCollection>
#include <QApplication>
#include <KoToolProxy.h>
......@@ -52,6 +53,7 @@ public:
, currentAction(0)
, currentShortcut(0)
, tabletPressEvent(0)
, setMirrorMode(false)
{ }
void match(QEvent *event);
......@@ -75,6 +77,8 @@ public:
QPointF mousePosition;
QTabletEvent *tabletPressEvent;
bool setMirrorMode;
};
KisInputManager::KisInputManager(KisCanvas2 *canvas, KoToolProxy *proxy)
......@@ -120,6 +124,13 @@ bool KisInputManager::eventFilter(QObject* object, QEvent* event)
canvas()->favoriteResourceManager()->slotShowPopupPalette();
return true;
}
if (d->setMirrorMode) {
d->canvas->resourceManager()->setResource(KisCanvasResourceProvider::MirrorAxisCenter, d->canvas->image()->documentToPixel(d->mousePosition));
QApplication::restoreOverrideCursor();
d->setMirrorMode = false;
return true;
}
} //Intentional fall through
case QEvent::KeyPress:
case QEvent::KeyRelease:
......@@ -247,7 +258,8 @@ QTabletEvent* KisInputManager::tabletPressEvent() const
void KisInputManager::setMirrorAxis()
{
d->canvas->resourceManager()->setResource(KisCanvasResourceProvider::MirrorAxisCenter, d->canvas->image()->documentToPixel(d->mousePosition));
d->setMirrorMode = true;
QApplication::setOverrideCursor(Qt::CrossCursor);
}
QPointF KisInputManager::widgetToPixel(const QPointF& position)
......
Supports Markdown
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