When create group selecting a control point should also select a curve.
--HG-- branch : develop
This commit is contained in:
parent
55754d227b
commit
cbf3e4d5df
|
@ -258,7 +258,7 @@ void VAbstractSpline::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||
*/
|
||||
QVariant VAbstractSpline::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == QGraphicsItem::ItemSelectedChange)
|
||||
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
{
|
||||
emit ChangedToolSelection(value.toBool(), m_id, m_id);
|
||||
}
|
||||
|
@ -418,6 +418,19 @@ VSpline VAbstractSpline::CorrectedSpline(const VSpline &spline, const SplinePoin
|
|||
return spl;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractSpline::CurveSelected(bool selected)
|
||||
{
|
||||
setSelected(selected);
|
||||
|
||||
foreach (auto *point, controlPoints)
|
||||
{
|
||||
point->blockSignals(true);
|
||||
point->setSelected(selected);
|
||||
point->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VAbstractSpline::InitDefShape()
|
||||
{
|
||||
|
|
|
@ -103,6 +103,8 @@ signals:
|
|||
* @param enable enable or diasable points.
|
||||
*/
|
||||
void setEnabledPoint(bool enable);
|
||||
protected slots:
|
||||
void CurveSelected(bool selected);
|
||||
protected:
|
||||
/**
|
||||
* @brief controlPoints list pointers of control points.
|
||||
|
|
|
@ -97,6 +97,7 @@ VToolSpline::VToolSpline(VToolSplineInitData initData, QGraphicsItem *parent)
|
|||
connect(this, &VToolSpline::setEnabledPoint, cPoint, &VControlPointSpline::setEnabledPoint);
|
||||
connect(cPoint, &VControlPointSpline::ShowContextMenu, this, &VToolSpline::contextMenuEvent);
|
||||
connect(cPoint, &VControlPointSpline::Released, this, &VToolSpline::CurveReleased);
|
||||
connect(cPoint, &VControlPointSpline::Selected, this, &VToolSpline::CurveSelected);
|
||||
controlPoints.append(cPoint);
|
||||
};
|
||||
|
||||
|
|
|
@ -102,6 +102,7 @@ VToolSplinePath::VToolSplinePath(const VToolSplinePathInitData &initData, QGraph
|
|||
connect(this, &VToolSplinePath::setEnabledPoint, cPoint, &VControlPointSpline::setEnabledPoint);
|
||||
connect(cPoint, &VControlPointSpline::ShowContextMenu, this, &VToolSplinePath::contextMenuEvent);
|
||||
connect(cPoint, &VControlPointSpline::Released, this, &VToolSplinePath::CurveReleased);
|
||||
connect(cPoint, &VControlPointSpline::Selected, this, &VToolSplinePath::CurveSelected);
|
||||
controlPoints.append(cPoint);
|
||||
};
|
||||
|
||||
|
|
|
@ -314,7 +314,7 @@ void VToolDoublePoint::UpdateNamePosition(quint32 id, const QPointF &pos)
|
|||
*/
|
||||
QVariant VToolDoublePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == QGraphicsItem::ItemSelectedChange)
|
||||
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
{
|
||||
if (value == true)
|
||||
{
|
||||
|
|
|
@ -214,7 +214,9 @@ void VToolSinglePoint::PointChoosed()
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
void VToolSinglePoint::PointSelected(bool selected)
|
||||
{
|
||||
m_selectedFromChild = true;
|
||||
setSelected(selected);
|
||||
m_selectedFromChild = false;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -261,11 +263,15 @@ void VToolSinglePoint::hoverEnterEvent(QGraphicsSceneHoverEvent *event)
|
|||
*/
|
||||
QVariant VToolSinglePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == QGraphicsItem::ItemSelectedChange)
|
||||
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
{
|
||||
if (not m_selectedFromChild)
|
||||
{
|
||||
m_namePoint->blockSignals(true);
|
||||
m_namePoint->setSelected(value.toBool());
|
||||
m_namePoint->blockSignals(false);
|
||||
}
|
||||
|
||||
emit ChangedToolSelection(value.toBool(), m_id, m_id);
|
||||
}
|
||||
|
||||
|
|
|
@ -326,7 +326,7 @@ void VToolLine::RemoveReferens()
|
|||
*/
|
||||
QVariant VToolLine::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == QGraphicsItem::ItemSelectedChange)
|
||||
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
{
|
||||
emit ChangedToolSelection(value.toBool(), m_id, m_id);
|
||||
}
|
||||
|
|
|
@ -1060,7 +1060,7 @@ QVariant VToolSeamAllowance::itemChange(QGraphicsItem::GraphicsItemChange change
|
|||
}
|
||||
}
|
||||
|
||||
if (change == QGraphicsItem::ItemSelectedChange)
|
||||
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
{
|
||||
if (value == true)
|
||||
{
|
||||
|
|
|
@ -210,6 +210,9 @@ QVariant VControlPointSpline::itemChange(QGraphicsItem::GraphicsItemChange chang
|
|||
}
|
||||
break;
|
||||
}
|
||||
case QGraphicsItem::ItemSelectedHasChanged:
|
||||
emit Selected(value.toBool());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -75,6 +75,7 @@ signals:
|
|||
*/
|
||||
void ShowContextMenu(QGraphicsSceneContextMenuEvent *event);
|
||||
void Released();
|
||||
void Selected(bool selected);
|
||||
public slots:
|
||||
void RefreshCtrlPoint(const qint32 &indexSpline, SplinePointPosition pos, const QPointF &controlPoint,
|
||||
const QPointF &splinePoint, bool freeAngle = true, bool freeLength = true);
|
||||
|
|
|
@ -192,11 +192,12 @@ QVariant VGraphicsSimpleTextItem::itemChange(GraphicsItemChange change, const QV
|
|||
changeFinished = true;
|
||||
}
|
||||
}
|
||||
if (change == QGraphicsItem::ItemSelectedChange)
|
||||
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
{
|
||||
setFlag(QGraphicsItem::ItemIsFocusable, value.toBool());
|
||||
emit PointSelected(value.toBool());
|
||||
}
|
||||
return QGraphicsItem::itemChange(change, value);
|
||||
return QGraphicsSimpleTextItem::itemChange(change, value);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
|
|
|
@ -48,7 +48,8 @@ VScenePoint::VScenePoint(QGraphicsItem *parent)
|
|||
m_onlyPoint(false),
|
||||
m_isHovered(false),
|
||||
m_showLabel(true),
|
||||
m_baseColor(Qt::black)
|
||||
m_baseColor(Qt::black),
|
||||
m_selectedFromChild(false)
|
||||
{
|
||||
m_namePoint = new VGraphicsSimpleTextItem(this);
|
||||
m_lineName = new VScaledLine(this);
|
||||
|
|
|
@ -67,6 +67,8 @@ protected:
|
|||
/** @brief m_baseColor base color of point. */
|
||||
QColor m_baseColor;
|
||||
|
||||
bool m_selectedFromChild;
|
||||
|
||||
virtual void hoverEnterEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
|
||||
virtual void hoverLeaveEvent(QGraphicsSceneHoverEvent *event) Q_DECL_OVERRIDE;
|
||||
|
||||
|
|
|
@ -146,7 +146,7 @@ void VSimpleCurve::hoverLeaveEvent(QGraphicsSceneHoverEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVariant VSimpleCurve::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == QGraphicsItem::ItemSelectedChange)
|
||||
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
{
|
||||
emit Selected(value.toBool(), id);
|
||||
}
|
||||
|
|
|
@ -220,7 +220,7 @@ void VSimplePoint::keyReleaseEvent(QKeyEvent *event)
|
|||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QVariant VSimplePoint::itemChange(QGraphicsItem::GraphicsItemChange change, const QVariant &value)
|
||||
{
|
||||
if (change == QGraphicsItem::ItemSelectedChange)
|
||||
if (change == QGraphicsItem::ItemSelectedHasChanged)
|
||||
{
|
||||
m_namePoint->blockSignals(true);
|
||||
m_namePoint->setSelected(value.toBool());
|
||||
|
|
Loading…
Reference in New Issue
Block a user