From bfd8e5d33453477a320be1ab081dd928a52ecc22 Mon Sep 17 00:00:00 2001 From: Abdullah Tahiri Date: Fri, 21 Apr 2023 18:56:31 +0200 Subject: [PATCH] Sketcher: Tooltips for solver message hyperlinks ================================================ I promised Uwe I would look into improving the information of the solver messages, including the abbreviation DoF. I wanted to keep the effort by Paddle to reduce the width of the taskbar. This commit introduces new explanatory tooltips for the hyperlinks, a different tooltip per type of information. UrlLabel sets the tooltips automatically to the url text on change. This commit modifies the tooltip just after the change, so that the meaningful tooltip is shown. --- src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp | 19 +++++++++++++++++++ src/Mod/Sketcher/Gui/TaskSketcherMessages.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp b/src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp index 965628c3a6..5c61fde5f9 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp +++ b/src/Mod/Sketcher/Gui/TaskSketcherMessages.cpp @@ -105,6 +105,25 @@ void TaskSketcherMessages::slotSetUp(const QString& state, const QString& msg, c ui->labelConstrainStatus->setText(msg); ui->labelConstrainStatusLink->setUrl(link); ui->labelConstrainStatusLink->setText(linkText); + updateToolTip(link); +} + +void TaskSketcherMessages::updateToolTip(const QString& link) +{ + if( link == QString::fromLatin1("#conflicting")) + ui->labelConstrainStatusLink->setToolTip(tr("Click to select the conflicting constraints.")); + else + if( link == QString::fromLatin1("#redundant")) + ui->labelConstrainStatusLink->setToolTip(tr("Click to select the redundant constraints.")); + else + if( link == QString::fromLatin1("#dofs")) + ui->labelConstrainStatusLink->setToolTip(tr("The sketch has unconstrained elements giving raise to those Degrees Of Freedom. Click to select the unconstrained elements.")); + else + if( link == QString::fromLatin1("#malformed")) + ui->labelConstrainStatusLink->setToolTip(tr("Click to select the malformed constraints.")); + else + if( link == QString::fromLatin1("#partiallyredundant")) + ui->labelConstrainStatusLink->setToolTip(tr("Some constraints in combination are partially redundant. Click to select the partially redundant constraints.")); } void TaskSketcherMessages::onLabelConstrainStatusLinkClicked(const QString &str) diff --git a/src/Mod/Sketcher/Gui/TaskSketcherMessages.h b/src/Mod/Sketcher/Gui/TaskSketcherMessages.h index 9bad27932e..6fb99b6f1e 100644 --- a/src/Mod/Sketcher/Gui/TaskSketcherMessages.h +++ b/src/Mod/Sketcher/Gui/TaskSketcherMessages.h @@ -54,6 +54,8 @@ private: void onLabelConstrainStatusLinkClicked(const QString &); void onAutoUpdateStateChanged(); void onManualUpdateClicked(bool checked); + + void updateToolTip(const QString& link); protected: ViewProviderSketch *sketchView;