[0.20] [GUI] Add tooltip to f(x) when there is no expression #4361
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
As suggested by @luzpaz, this adds a tooltip to the f(x) icon of all of the widgets that use it:
QuantitySpinBox
,UIntSpinBox
,IntSpinBox
,DoubleSpinBox
, andExpLineEdit
. These five classes are divided across three files, and all five classes duplicate the same basic code. In the existing code, no tooltip is shown if there is no expression. If there is an expression, it (alone) is used as the tooltip.This commit modifies that behavior to have explanatory text as the tooltip when there is no expression, and when there is, to prepend a short string to the beginning.
To reduce further code duplication, this is implemented by adding a new function to
ExpressionLabel
allowing the text of the expression to be set. It checks that text and if it's empty, uses a preset default string as the tooltip. If there is expression text, it instead prepends another bit of text to the front and sets the entire expression+prefix as the tooltip.TODO: In the future a lot of the preexisting code duplication could be removed by making the
ExpressionLabel
class do more internal management of the expression.Thanks to @kisolre for the assistance tracking these down, and suggesting the default text used. Forum discussion topic: https://forum.freecadweb.org/viewtopic.php?f=17&t=55146
git pull --rebase upstream master
./bin/FreeCAD --run-test 0