Tooltip for complex tools.
--HG-- branch : feature
This commit is contained in:
parent
6f160ebd9c
commit
2e8f113e3e
|
@ -229,6 +229,15 @@ void VToolFlippingByAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
|
|||
SaveSourceDestination(tag);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VToolFlippingByAxis::MakeToolTip() const
|
||||
{
|
||||
const QString toolTip = QString("<tr> <td><b>%1:</b> %2</td> </tr>")
|
||||
.arg(tr("Origin point"))
|
||||
.arg(OriginPointName());
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolFlippingByAxis::VToolFlippingByAxis(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 originPointId,
|
||||
AxisType axisType, const QString &suffix,
|
||||
|
|
|
@ -61,10 +61,11 @@ public:
|
|||
protected slots:
|
||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolFlippingByAxis)
|
||||
|
||||
|
|
|
@ -215,6 +215,18 @@ void VToolFlippingByLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
|
|||
SaveSourceDestination(tag);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VToolFlippingByLine::MakeToolTip() const
|
||||
{
|
||||
const QString toolTip = QString("<tr> <td><b>%1:</b> %2</td> </tr>"
|
||||
"<tr> <td><b>%3:</b> %4</td> </tr>")
|
||||
.arg(tr("First line point"))
|
||||
.arg(FirstLinePointName())
|
||||
.arg(tr("Second line point"))
|
||||
.arg(SecondLinePointName());
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolFlippingByLine::VToolFlippingByLine(VAbstractPattern *doc, VContainer *data, quint32 id, quint32 firstLinePointId,
|
||||
quint32 secondLinePointId, const QString &suffix,
|
||||
|
|
|
@ -59,10 +59,11 @@ public:
|
|||
protected slots:
|
||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolFlippingByLine)
|
||||
|
||||
|
|
|
@ -138,12 +138,14 @@ void VAbstractOperation::FullUpdateFromFile()
|
|||
{
|
||||
VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
|
||||
SCASSERT(item != nullptr)
|
||||
item->setToolTip(ComplexPointToolTip(i.key()));
|
||||
item->RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(i.key()));
|
||||
}
|
||||
else
|
||||
{
|
||||
VSimpleCurve *item = qobject_cast<VSimpleCurve *>(i.value());
|
||||
SCASSERT(item != nullptr)
|
||||
item->setToolTip(ComplexCurveToolTip(i.key()));
|
||||
item->RefreshGeometry(VAbstractTool::data.GeometricObject<VAbstractCurve>(i.key()));
|
||||
}
|
||||
}
|
||||
|
@ -473,6 +475,7 @@ void VAbstractOperation::InitCurve(quint32 id, VContainer *data, GOType curveTyp
|
|||
VSimpleCurve *curve = new VSimpleCurve(id, initCurve);
|
||||
curve->setParentItem(this);
|
||||
curve->SetType(curveType);
|
||||
curve->setToolTip(ComplexCurveToolTip(id));
|
||||
connect(curve, &VSimpleCurve::Selected, this, &VAbstractOperation::ObjectSelected);
|
||||
connect(curve, &VSimpleCurve::ShowContextMenu, this, [this](QGraphicsSceneContextMenuEvent * event, quint32 id)
|
||||
{
|
||||
|
@ -570,6 +573,7 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
|||
VSimplePoint *point = new VSimplePoint(object.id, QColor(Qt::black));
|
||||
point->setParentItem(this);
|
||||
point->SetType(GOType::Point);
|
||||
point->setToolTip(ComplexPointToolTip(object.id));
|
||||
connect(point, &VSimplePoint::Choosed, this, [this](quint32 id)
|
||||
{
|
||||
emit ChoosedTool(id, SceneObject::Point);
|
||||
|
@ -606,3 +610,35 @@ QT_WARNING_DISABLE_GCC("-Wswitch-default")
|
|||
QT_WARNING_POP
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractOperation::ComplexPointToolTip(quint32 itemId) const
|
||||
{
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(itemId);
|
||||
|
||||
const QString toolTip = QString("<table>"
|
||||
"<tr> <td><b>%1:</b> %2</td> </tr>"
|
||||
"%3"
|
||||
"</table>")
|
||||
.arg(tr("Label"), point->name(), MakeToolTip());
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VAbstractOperation::ComplexCurveToolTip(quint32 itemId) const
|
||||
{
|
||||
const QSharedPointer<VAbstractCurve> curve = VAbstractTool::data.GeometricObject<VAbstractCurve>(itemId);
|
||||
|
||||
const QString toolTip = QString("<table>"
|
||||
"<tr> <td><b>%1:</b> %2</td> </tr>"
|
||||
"<tr> <td><b>%3:</b> %4 %5</td> </tr>"
|
||||
"%6"
|
||||
"</table>")
|
||||
.arg(tr("Label"))
|
||||
.arg(curve->name())
|
||||
.arg(tr("Length"))
|
||||
.arg(qApp->fromPixel(curve->GetLength()))
|
||||
.arg(UnitsToStr(qApp->patternUnit(), true))
|
||||
.arg(MakeToolTip());
|
||||
return toolTip;
|
||||
}
|
||||
|
|
|
@ -131,6 +131,9 @@ protected:
|
|||
static void InitOperationToolConnections(VMainGraphicsScene *scene, T *tool);
|
||||
|
||||
void InitOperatedObjects();
|
||||
|
||||
QString ComplexPointToolTip(quint32 itemId) const;
|
||||
QString ComplexCurveToolTip(quint32 itemId) const;
|
||||
protected slots:
|
||||
void DoChangePosition(quint32 id, qreal mx, qreal my);
|
||||
private:
|
||||
|
|
|
@ -347,6 +347,19 @@ void VToolMove::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
SaveSourceDestination(tag);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VToolMove::MakeToolTip() const
|
||||
{
|
||||
const QString toolTip = QString("<tr> <td><b>%1:</b> %2°</td> </tr>"
|
||||
"<tr> <td><b>%3:</b> %4 %5</td> </tr>")
|
||||
.arg(tr("Rotation angle"))
|
||||
.arg(GetFormulaAngle().getDoubleValue())
|
||||
.arg(tr("Length"))
|
||||
.arg(GetFormulaLength().getDoubleValue())
|
||||
.arg(UnitsToStr(qApp->patternUnit(), true));
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolMove::VToolMove(VAbstractPattern *doc, VContainer *data, quint32 id,
|
||||
const QString &formulaAngle, const QString &formulaLength, const QString &suffix,
|
||||
|
|
|
@ -73,11 +73,11 @@ public:
|
|||
protected slots:
|
||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||
|
||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolMove)
|
||||
QString formulaAngle;
|
||||
|
|
|
@ -347,6 +347,18 @@ void VToolRotation::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
|
|||
SaveSourceDestination(tag);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VToolRotation::MakeToolTip() const
|
||||
{
|
||||
const QString toolTip = QString("<tr> <td><b>%1:</b> %2</td> </tr>"
|
||||
"<tr> <td><b>%3:</b> %4°</td> </tr>")
|
||||
.arg(tr("Origin point"))
|
||||
.arg(OriginPointName())
|
||||
.arg(tr("Rotation angle"))
|
||||
.arg(GetFormulaAngle().getDoubleValue());
|
||||
return toolTip;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
DestinationItem VToolRotation::CreatePoint(quint32 idTool, quint32 idItem, const QPointF &origin, qreal angle,
|
||||
const QString &suffix, VContainer *data)
|
||||
|
|
|
@ -72,10 +72,11 @@ public:
|
|||
protected slots:
|
||||
virtual void ShowContextMenu(QGraphicsSceneContextMenuEvent *event, quint32 id=NULL_ID) Q_DECL_OVERRIDE;
|
||||
protected:
|
||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||
virtual void SetVisualization() Q_DECL_OVERRIDE;
|
||||
virtual void SaveDialog(QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void ReadToolAttributes(const QDomElement &domElement) Q_DECL_OVERRIDE;
|
||||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolRotation)
|
||||
|
|
|
@ -83,7 +83,6 @@ public slots:
|
|||
virtual void DetailsMode(bool mode) Q_DECL_OVERRIDE;
|
||||
virtual void AllowHover(bool enabled) Q_DECL_OVERRIDE;
|
||||
virtual void AllowSelecting(bool enabled) Q_DECL_OVERRIDE;
|
||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||
signals:
|
||||
/**
|
||||
* @brief setEnabledPoint disable control points.
|
||||
|
@ -113,6 +112,7 @@ protected:
|
|||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||
virtual void RefreshCtrlPoints();
|
||||
virtual void contextMenuEvent ( QGraphicsSceneContextMenuEvent * event ) Q_DECL_OVERRIDE;
|
||||
virtual QString MakeToolTip() const Q_DECL_OVERRIDE;
|
||||
|
||||
VSpline CorrectedSpline(const VSpline &spline, const SplinePointPosition &position, const QPointF &pos) const;
|
||||
|
||||
|
|
|
@ -65,6 +65,7 @@ VToolDoublePoint::VToolDoublePoint(VAbstractPattern *doc, VContainer *data, quin
|
|||
{
|
||||
firstPoint = new VSimplePoint(p1id, QColor(Qt::black));
|
||||
firstPoint->setParentItem(this);
|
||||
firstPoint->setToolTip(ComplexToolTip(p1id));
|
||||
connect(firstPoint, &VSimplePoint::Choosed, this, &VToolDoublePoint::Point1Choosed);
|
||||
connect(firstPoint, &VSimplePoint::Selected, this, &VToolDoublePoint::Point1Selected);
|
||||
connect(firstPoint, &VSimplePoint::ShowContextMenu, this, &VToolDoublePoint::ShowContextMenu);
|
||||
|
@ -74,6 +75,7 @@ VToolDoublePoint::VToolDoublePoint(VAbstractPattern *doc, VContainer *data, quin
|
|||
|
||||
secondPoint = new VSimplePoint(p2id, QColor(Qt::black));
|
||||
secondPoint->setParentItem(this);
|
||||
secondPoint->setToolTip(ComplexToolTip(p2id));
|
||||
connect(secondPoint, &VSimplePoint::Choosed, this, &VToolDoublePoint::Point2Choosed);
|
||||
connect(secondPoint, &VSimplePoint::Selected, this, &VToolDoublePoint::Point2Selected);
|
||||
connect(secondPoint, &VSimplePoint::ShowContextMenu, this, &VToolDoublePoint::ShowContextMenu);
|
||||
|
@ -175,7 +177,9 @@ void VToolDoublePoint::Point2Selected(bool selected)
|
|||
void VToolDoublePoint::FullUpdateFromFile()
|
||||
{
|
||||
ReadAttributes();
|
||||
firstPoint->setToolTip(ComplexToolTip(p1id));
|
||||
firstPoint->RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(p1id));
|
||||
secondPoint->setToolTip(ComplexToolTip(p2id));
|
||||
secondPoint->RefreshPointGeometry(*VAbstractTool::data.GeometricObject<VPointF>(p2id));
|
||||
SetVisualization();
|
||||
}
|
||||
|
@ -363,3 +367,16 @@ void VToolDoublePoint::AddToFile()
|
|||
SaveOptions(domElement, obj);
|
||||
AddToCalculation(domElement);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
QString VToolDoublePoint::ComplexToolTip(quint32 itemId) const
|
||||
{
|
||||
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(itemId);
|
||||
|
||||
const QString toolTip = QString("<table>"
|
||||
"<tr> <td><b>%1:</b> %2</td> </tr>"
|
||||
"%3"
|
||||
"</table>")
|
||||
.arg(tr("Label"), point->name(), MakeToolTip());
|
||||
return toolTip;
|
||||
}
|
||||
|
|
|
@ -94,6 +94,8 @@ protected:
|
|||
virtual void SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj) Q_DECL_OVERRIDE;
|
||||
virtual void AddToFile() Q_DECL_OVERRIDE;
|
||||
|
||||
QString ComplexToolTip(quint32 itemId) const;
|
||||
|
||||
private:
|
||||
Q_DISABLE_COPY(VToolDoublePoint)
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue
Block a user