[calligra] krita/ui/tool: BUG: 324170
Sven Langkamp
sven.langkamp at gmail.com
Wed Oct 30 10:36:48 UTC 2013
On Wed, Oct 30, 2013 at 11:19 AM, Lukast dev <lukast.dev at gmail.com> wrote:
> > + undo_polygon_selection->setShortcut(QKeySequence(Qt::ShiftModifier
> + Qt::Key_Z));
>
> I suppose this is not needed, standard system Undo shortcut will undo some
> operation
>
>
No, the standard action would undo the complete polygon. This removes just
the last point.
>
> 2013/10/30 Salil Kapur <salilkapur93 at gmail.com>
>
>> Git commit fd128ac2c97f2016575a0424c0476d08e633fb33 by Salil Kapur.
>> Committed on 30/10/2013 at 10:12.
>> Pushed by salilkapur into branch 'master'.
>>
>> BUG: 324170
>> Add shortcut to undo last polygonal selection point(s)
>>
>> M +28 -0 krita/ui/tool/kis_tool_polyline_base.cpp
>> M +3 -0 krita/ui/tool/kis_tool_polyline_base.h
>>
>> http://commits.kde.org/calligra/fd128ac2c97f2016575a0424c0476d08e633fb33
>>
>> diff --git a/krita/ui/tool/kis_tool_polyline_base.cpp
>> b/krita/ui/tool/kis_tool_polyline_base.cpp
>> index 771783b..8b9389c 100644
>> --- a/krita/ui/tool/kis_tool_polyline_base.cpp
>> +++ b/krita/ui/tool/kis_tool_polyline_base.cpp
>> @@ -27,6 +27,10 @@
>> #include <KoViewConverter.h>
>>
>> #include "kis_tool_polyline_base.h"
>> +#include "kis_canvas2.h"
>> +#include <kis_view2.h>
>> +#include <kis_action.h>
>> +#include <kactioncollection.h>
>>
>> #define SNAPPING_THRESHOLD 10
>> #define SNAPPING_HANDLE_RADIUS 8
>> @@ -38,6 +42,12 @@ KisToolPolylineBase::KisToolPolylineBase(KoCanvasBase
>> * canvas, KisToolPolyline
>> m_type(type),
>> m_closeSnappingActivated(false)
>> {
>> +
>> + KisCanvas2 * kiscanvas = static_cast<KisCanvas2*>(this->canvas());
>> + KAction *undo_polygon_selection = new KAction("Undo Polygon
>> Selection Points",this);
>> + undo_polygon_selection->setShortcut(QKeySequence(Qt::ShiftModifier +
>> Qt::Key_Z));
>> +
>> kiscanvas->view()->actionCollection()->addAction("undo_polygon_selection",
>> undo_polygon_selection);
>> + connect(undo_polygon_selection, SIGNAL(triggered()),
>> SLOT(undoSelection()));
>> }
>>
>> void KisToolPolylineBase::deactivate()
>> @@ -137,6 +147,24 @@ void
>> KisToolPolylineBase::mouseDoubleClickEvent(KoPointerEvent *event)
>> }
>> }
>>
>> +void KisToolPolylineBase::undoSelection()
>> +{
>> + if(m_dragging) {
>> + //Update canvas for drag before undo
>> + QRectF updateRect = dragBoundingRect();
>> + updateRect |= dragBoundingRect();
>> + updateCanvasViewRect(updateRect);
>> +
>> + //Update canvas for last segment
>> + QRectF rect = pixelToView(QRectF(m_points.last(), m_points.at
>> (m_points.size()-2)).normalized());
>> + rect.adjust(-PREVIEW_LINE_WIDTH, -PREVIEW_LINE_WIDTH,
>> PREVIEW_LINE_WIDTH, PREVIEW_LINE_WIDTH);
>> + rect |= rect;
>> + updateCanvasViewRect(rect);
>> + m_points.pop_back();
>> + m_dragStart = m_points.last();
>> + }
>> +}
>> +
>> void KisToolPolylineBase::paint(QPainter& gc, const KoViewConverter
>> &converter)
>> {
>> Q_UNUSED(converter);
>> diff --git a/krita/ui/tool/kis_tool_polyline_base.h
>> b/krita/ui/tool/kis_tool_polyline_base.h
>> index 7d38d24..dc91daa 100644
>> --- a/krita/ui/tool/kis_tool_polyline_base.h
>> +++ b/krita/ui/tool/kis_tool_polyline_base.h
>> @@ -53,6 +53,9 @@ private:
>> void updateArea();
>> QRectF dragBoundingRect();
>>
>> +private slots:
>> + virtual void undoSelection();
>> +
>> private:
>>
>> QPointF m_dragStart;
>>
>
>
> _______________________________________________
> Krita mailing list
> kimageshop at kde.org
> https://mail.kde.org/mailman/listinfo/kimageshop
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kimageshop/attachments/20131030/9d998658/attachment.html>
More information about the kimageshop
mailing list