Show linked visibility group in group operation tooltip.

This commit is contained in:
Roman Telezhynskyi 2020-03-24 17:27:16 +02:00
parent 11718f6f44
commit a84857afda
8 changed files with 55 additions and 10 deletions

View File

@ -279,6 +279,7 @@ void VWidgetGroups::UpdateGroups()
//---------------------------------------------------------------------------------------------------------------------
void VWidgetGroups::FillTable(const QMap<quint32, QPair<QString, bool> > &groups)
{
emit doc->UpdateToolTip();
ui->tableWidget->blockSignals(true);
ui->tableWidget->clear();

View File

@ -406,7 +406,8 @@ signals:
/**
* @brief UpdateGroups emit if the groups have been updated
*/
void UpdateGroups();
void UpdateGroups();
void UpdateToolTip();
public slots:
virtual void LiteParseTree(const Document &parse)=0;

View File

@ -254,8 +254,10 @@ void VToolFlippingByAxis::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
//---------------------------------------------------------------------------------------------------------------------
QString VToolFlippingByAxis::MakeToolTip() const
{
return QStringLiteral("<tr> <td><b>%1:</b> %2</td> </tr>")
.arg(tr("Origin point"), OriginPointName());
return QStringLiteral("<tr> <td><b>%1:</b> %2</td> </tr>"
"%3")
.arg(tr("Origin point"), OriginPointName()) // 1, 2
.arg(VisibilityGroupToolTip()); // 3
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -242,8 +242,11 @@ void VToolFlippingByLine::SaveOptions(QDomElement &tag, QSharedPointer<VGObject>
QString VToolFlippingByLine::MakeToolTip() const
{
return QStringLiteral("<tr> <td><b>%1:</b> %2</td> </tr>"
"<tr> <td><b>%3:</b> %4</td> </tr>")
.arg(tr("First line point"), FirstLinePointName(), tr("Second line point"), SecondLinePointName());
"<tr> <td><b>%3:</b> %4</td> </tr>"
"%5")
.arg(tr("First line point"), FirstLinePointName(),
tr("Second line point"), SecondLinePointName()) // 1, 2, 3, 4
.arg(VisibilityGroupToolTip()); // 5
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -530,6 +530,26 @@ VAbstractOperation::VAbstractOperation(VAbstractPattern *doc, VContainer *data,
destination(destination),
operatedObjects()
{
connect(doc, &VAbstractPattern::UpdateToolTip, [this]()
{
QMapIterator<quint32, VAbstractSimple *> i(operatedObjects);
while (i.hasNext())
{
i.next();
if (i.value()->GetType() == GOType::Point)
{
VSimplePoint *item = qobject_cast<VSimplePoint *>(i.value());
SCASSERT(item != nullptr)
item->setToolTip(ComplexPointToolTip(i.key()));
}
else
{
VSimpleCurve *item = qobject_cast<VSimpleCurve *>(i.value());
SCASSERT(item != nullptr)
item->setToolTip(ComplexCurveToolTip(i.key()));
}
}
});
}
//---------------------------------------------------------------------------------------------------------------------
@ -873,6 +893,19 @@ QString VAbstractOperation::ComplexCurveToolTip(quint32 itemId) const
return toolTip;
}
//---------------------------------------------------------------------------------------------------------------------
QString VAbstractOperation::VisibilityGroupToolTip() const
{
vidtype group = doc->GroupLinkedToTool(m_id);
if (group != null_id)
{
return QStringLiteral("<tr> <td><b>%1:</b> %2</td> </tr>")
.arg(tr("Visibility group"), doc->GetGroupName(group)); // 1, 2
}
return QString();
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractOperation::CreateVisibilityGroup(const VAbstractOperationInitData &initData)
{

View File

@ -163,6 +163,7 @@ protected:
QString ComplexPointToolTip(quint32 itemId) const;
QString ComplexCurveToolTip(quint32 itemId) const;
QString VisibilityGroupToolTip() const;
static void CreateVisibilityGroup(const VAbstractOperationInitData & initData);
private:

View File

@ -517,7 +517,8 @@ QString VToolMove::MakeToolTip() const
return QStringLiteral("<tr> <td><b>%1:</b> %2°</td> </tr>"
"<tr> <td><b>%3:</b> %4 %5</td> </tr>"
"<tr> <td><b>%6:</b> %7°</td> </tr>"
"<tr> <td><b>%8:</b> %9</td> </tr>")
"<tr> <td><b>%8:</b> %9</td> </tr>"
"%10")
.arg(tr("Angle")) // 1
.arg(GetFormulaAngle().getDoubleValue()) // 2
.arg(tr("Length")) // 3
@ -526,7 +527,8 @@ QString VToolMove::MakeToolTip() const
tr("Rotation angle")) // 6
.arg(GetFormulaRotationAngle().getDoubleValue()) // 7
.arg(tr("Rotation origin point"), // 8
OriginPointName()); // 9
OriginPointName()) // 9
.arg(VisibilityGroupToolTip()); // 10
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -391,9 +391,11 @@ void VToolRotation::SaveOptions(QDomElement &tag, QSharedPointer<VGObject> &obj)
QString VToolRotation::MakeToolTip() const
{
return QStringLiteral("<tr> <td><b>%1:</b> %2</td> </tr>"
"<tr> <td><b>%3:</b> %4°</td> </tr>")
.arg(tr("Origin point"), OriginPointName(), tr("Rotation angle"))
.arg(GetFormulaAngle().getDoubleValue());
"<tr> <td><b>%3:</b> %4°</td> </tr>"
"%5")
.arg(tr("Origin point"), OriginPointName(), tr("Rotation angle")) // 1, 2, 3
.arg(GetFormulaAngle().getDoubleValue()) // 4
.arg(VisibilityGroupToolTip()); // 5
}
//---------------------------------------------------------------------------------------------------------------------