Delete key did not work.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-05-08 18:04:18 +03:00
parent e3d582fc5e
commit 49bee0cada
12 changed files with 30 additions and 4 deletions

View File

@ -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 );
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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);
}

View File

@ -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<VSpline>(id);

View File

@ -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<VSplinePath> splPath = data->GeometricObject<VSplinePath>(id);
for (qint32 i = 1; i<=splPath->CountSubSpl(); ++i)

View File

@ -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<VPointF>(id));
}

View File

@ -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 );
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -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);

View File

@ -35,6 +35,7 @@
#include <QGraphicsSceneMouseEvent>
#include <QStyleOptionGraphicsItem>
#include <QPen>
#include <QKeyEvent>
//---------------------------------------------------------------------------------------------------------------------
VSimplePoint::VSimplePoint(quint32 id, const QColor &currentColor, Unit patternUnit, qreal *factor, QObject *parent)
@ -52,6 +53,7 @@ VSimplePoint::VSimplePoint(quint32 id, const QColor &currentColor, 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)
{

View File

@ -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: