diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp index 7d7b5f03c..b81d06eeb 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vabstractspline.cpp @@ -169,7 +169,7 @@ QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, c emit ChangedToolSelection(value.toBool(), id, id); } - return QGraphicsItem::itemChange(change, value); + return QGraphicsPathItem::itemChange(change, value); } //--------------------------------------------------------------------------------------------------------------------- @@ -195,7 +195,7 @@ void VAbstractSpline::keyReleaseEvent(QKeyEvent *event) default: break; } - QGraphicsItem::keyReleaseEvent ( event ); + QGraphicsPathItem::keyReleaseEvent ( event ); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp index de9687018..c35e0f0f4 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarc.cpp @@ -58,6 +58,7 @@ VToolArc::VToolArc(VAbstractPattern *doc, VContainer *data, quint32 id, const QS this->setPath(ToolPath()); this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); + this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus ToolCreation(typeCreation); } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp index f0edac174..7b5ff3e6f 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolarcwithlength.cpp @@ -49,6 +49,7 @@ VToolArcWithLength::VToolArcWithLength(VAbstractPattern *doc, VContainer *data, this->setPath(ToolPath()); this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); + this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus ToolCreation(typeCreation); } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp index 81ac6476e..35f000c6a 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezier.cpp @@ -44,6 +44,7 @@ VToolCubicBezier::VToolCubicBezier(VAbstractPattern *doc, VContainer *data, quin this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); this->setPath(ToolPath()); + this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus ToolCreation(typeCreation); } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp index 19f56c3f7..a5febd61e 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolcubicbezierpath.cpp @@ -42,6 +42,7 @@ VToolCubicBezierPath::VToolCubicBezierPath(VAbstractPattern *doc, VContainer *da this->setPath(ToolPath()); this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); + this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus ToolCreation(typeCreation); } diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp index 077e5957d..1857ef870 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolspline.cpp @@ -62,6 +62,7 @@ VToolSpline::VToolSpline(VAbstractPattern *doc, VContainer *data, quint32 id, co this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); this->setFlag(QGraphicsItem::ItemIsMovable, true); + this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus this->setPath(ToolPath()); const auto spl = VAbstractTool::data.GeometricObject(id); diff --git a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp index 2456396d9..9a09d2beb 100644 --- a/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp +++ b/src/libs/vtools/tools/drawTools/toolcurve/vtoolsplinepath.cpp @@ -63,6 +63,7 @@ VToolSplinePath::VToolSplinePath(VAbstractPattern *doc, VContainer *data, quint3 this->setPath(ToolPath()); this->setPen(QPen(Qt::black, qApp->toPixel(WidthHairLine(*VAbstractTool::data.GetPatternUnit()))/factor)); this->setFlag(QGraphicsItem::ItemIsMovable, true); + this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus const QSharedPointer splPath = data->GeometricObject(id); for (qint32 i = 1; i<=splPath->CountSubSpl(); ++i) diff --git a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp index 0fc8aca76..be9c4edb9 100644 --- a/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp +++ b/src/libs/vtools/tools/drawTools/toolpoint/toolsinglepoint/vtoolsinglepoint.cpp @@ -71,6 +71,7 @@ VToolSinglePoint::VToolSinglePoint(VAbstractPattern *doc, VContainer *data, quin lineName = new QGraphicsLineItem(this); this->setBrush(QBrush(Qt::NoBrush)); this->setAcceptHoverEvents(true); + this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus RefreshPointGeometry(*VAbstractTool::data.GeometricObject(id)); } diff --git a/src/libs/vtools/tools/vtooldetail.cpp b/src/libs/vtools/tools/vtooldetail.cpp index 62252cba3..25cdede3c 100644 --- a/src/libs/vtools/tools/vtooldetail.cpp +++ b/src/libs/vtools/tools/vtooldetail.cpp @@ -111,6 +111,7 @@ VToolDetail::VToolDetail(VAbstractPattern *doc, VContainer *data, const quint32 seamAllowance->setBrush(QBrush(Qt::FDiagPattern)); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); + this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus connect(scene, &VMainGraphicsScene::EnableToolMove, this, &VToolDetail::EnableToolMove); if (typeCreation == Source::FromGui || typeCreation == Source::FromTool) @@ -428,7 +429,7 @@ QVariant VToolDetail::itemChange(QGraphicsItem::GraphicsItemChange change, const } } - return QGraphicsItem::itemChange(change, value); + return VNoBrushScalePathItem::itemChange(change, value); } //--------------------------------------------------------------------------------------------------------------------- @@ -454,7 +455,7 @@ void VToolDetail::keyReleaseEvent(QKeyEvent *event) default: break; } - QGraphicsItem::keyReleaseEvent ( event ); + VNoBrushScalePathItem::keyReleaseEvent ( event ); } //--------------------------------------------------------------------------------------------------------------------- diff --git a/src/libs/vwidgets/vgraphicssimpletextitem.cpp b/src/libs/vwidgets/vgraphicssimpletextitem.cpp index 093a14051..438133bf9 100644 --- a/src/libs/vwidgets/vgraphicssimpletextitem.cpp +++ b/src/libs/vwidgets/vgraphicssimpletextitem.cpp @@ -50,6 +50,7 @@ VGraphicsSimpleTextItem::VGraphicsSimpleTextItem(QGraphicsItem * parent) this->setFlag(QGraphicsItem::ItemIsMovable, true); this->setFlag(QGraphicsItem::ItemIsSelectable, true); this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); + this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus this->setAcceptHoverEvents(true); QFont font = this->font(); font.setPointSize(font.pointSize()+20); diff --git a/src/libs/vwidgets/vsimplepoint.cpp b/src/libs/vwidgets/vsimplepoint.cpp index 0fafd4051..6819d52c0 100644 --- a/src/libs/vwidgets/vsimplepoint.cpp +++ b/src/libs/vwidgets/vsimplepoint.cpp @@ -35,6 +35,7 @@ #include #include #include +#include //--------------------------------------------------------------------------------------------------------------------- VSimplePoint::VSimplePoint(quint32 id, const QColor ¤tColor, Unit patternUnit, qreal *factor, QObject *parent) @@ -52,6 +53,7 @@ VSimplePoint::VSimplePoint(quint32 id, const QColor ¤tColor, Unit patternU this->setBrush(QBrush(Qt::NoBrush)); SetPen(this, currentColor, WidthHairLine(patternUnit)); this->setAcceptHoverEvents(true); + this->setFlag(QGraphicsItem::ItemIsFocusable, true);// For keyboard input focus } //--------------------------------------------------------------------------------------------------------------------- @@ -229,6 +231,20 @@ void VSimplePoint::hoverLeaveEvent(QGraphicsSceneHoverEvent *event) QGraphicsEllipseItem::hoverLeaveEvent(event); } +//--------------------------------------------------------------------------------------------------------------------- +void VSimplePoint::keyReleaseEvent(QKeyEvent *event) +{ + switch (event->key()) + { + case Qt::Key_Delete: + emit Delete(); + return; //Leave this method immediately after call!!! + default: + break; + } + QGraphicsEllipseItem::keyReleaseEvent ( event ); +} + //--------------------------------------------------------------------------------------------------------------------- QVariant VSimplePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value) { diff --git a/src/libs/vwidgets/vsimplepoint.h b/src/libs/vwidgets/vsimplepoint.h index c412ee594..26734429c 100644 --- a/src/libs/vwidgets/vsimplepoint.h +++ b/src/libs/vwidgets/vsimplepoint.h @@ -82,6 +82,7 @@ protected: virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE; virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE; virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE; + virtual void keyReleaseEvent ( QKeyEvent * event ) Q_DECL_OVERRIDE; virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE; private: