Select an item inside mousePressEvent() instead mouseReleaseEvent().
--HG-- branch : feature
This commit is contained in:
parent
623c28eb9f
commit
8683b69f13
|
@ -204,16 +204,16 @@ void VAbstractSpline::keyReleaseEvent(QKeyEvent *event)
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief mouseReleaseEvent handle mouse release events.
|
||||
* @brief mousePressEvent handle mouse press events.
|
||||
* @param event mouse release event.
|
||||
*/
|
||||
void VAbstractSpline::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
void VAbstractSpline::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
emit ChoosedTool(id, sceneType);
|
||||
}
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
QGraphicsPathItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -88,7 +88,7 @@ protected:
|
|||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual QVariant itemChange ( GraphicsItemChange change, const QVariant &value ) Q_DECL_OVERRIDE;
|
||||
virtual void keyReleaseEvent(QKeyEvent * event) Q_DECL_OVERRIDE;
|
||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||
QPainterPath ToolPath(PathDirection direction = PathDirection::Hide) const;
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||
|
|
|
@ -177,16 +177,16 @@ void VToolSinglePoint::FullUpdateFromFile()
|
|||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
/**
|
||||
* @brief mouseReleaseEvent handle mouse release events.
|
||||
* @brief mousePressEvent handle mouse press events.
|
||||
* @param event mouse release event.
|
||||
*/
|
||||
void VToolSinglePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
void VToolSinglePoint::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
PointChoosed();
|
||||
}
|
||||
QGraphicsEllipseItem::mouseReleaseEvent(event);
|
||||
QGraphicsEllipseItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -73,7 +73,7 @@ protected:
|
|||
QGraphicsLineItem *lineName;
|
||||
|
||||
virtual void UpdateNamePosition(quint32 id) Q_DECL_OVERRIDE;
|
||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void RefreshPointGeometry(const VPointF &point);
|
||||
|
|
|
@ -446,9 +446,14 @@ void VToolDetail::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
event->accept();
|
||||
}
|
||||
}
|
||||
|
||||
if (event->button() == Qt::LeftButton && event->type() != QEvent::GraphicsSceneMouseDoubleClick)
|
||||
{
|
||||
emit ChoosedTool(id, SceneObject::Detail);
|
||||
}
|
||||
|
||||
VNoBrushScalePathItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
|
@ -461,11 +466,10 @@ void VToolDetail::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
emit ChoosedTool(id, SceneObject::Detail);
|
||||
//Disable cursor-arrow-closehand
|
||||
RestoreOverrideCursor(cursorArrowCloseHand);
|
||||
}
|
||||
QGraphicsItem::mouseReleaseEvent(event);
|
||||
VNoBrushScalePathItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -217,6 +217,9 @@ void VGraphicsSimpleTextItem::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
|||
SetOverrideCursor(cursorArrowCloseHand, 1, 1);
|
||||
}
|
||||
}
|
||||
|
||||
emit PointChoosed();
|
||||
|
||||
QGraphicsSimpleTextItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
|
@ -231,10 +234,7 @@ void VGraphicsSimpleTextItem::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
|||
RestoreOverrideCursor(cursorArrowCloseHand);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
emit PointChoosed();
|
||||
}
|
||||
|
||||
QGraphicsSimpleTextItem::mouseReleaseEvent(event);
|
||||
}
|
||||
|
||||
|
|
|
@ -173,13 +173,13 @@ void VSimplePoint::ContextMenu(QGraphicsSceneContextMenuEvent *event)
|
|||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VSimplePoint::mouseReleaseEvent(QGraphicsSceneMouseEvent *event)
|
||||
void VSimplePoint::mousePressEvent(QGraphicsSceneMouseEvent *event)
|
||||
{
|
||||
if (event->button() == Qt::LeftButton)
|
||||
{
|
||||
emit Choosed(id);
|
||||
}
|
||||
QGraphicsEllipseItem::mouseReleaseEvent(event);
|
||||
QGraphicsEllipseItem::mousePressEvent(event);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -75,7 +75,7 @@ public slots:
|
|||
void ContextMenu(QGraphicsSceneContextMenuEvent * event);
|
||||
|
||||
protected:
|
||||
virtual void mouseReleaseEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void mousePressEvent ( QGraphicsSceneMouseEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void hoverEnterEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual void hoverLeaveEvent ( QGraphicsSceneHoverEvent * event ) Q_DECL_OVERRIDE;
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user