PR 4361
This PR comes from a suggestion by @luzpaz on Gitter, so there hasn't been any discussion of it here, as far as I am aware. There were several different ways this could have been implemented, so if you have any thoughts we can discuss it here.
At first it seemed very innocuous: just adding a tooltip to the little f(x) symbol where you click to access the formula. The old behavior was that there was no tooltip if there was no expression, and the expression itself as the tooltip if there was. This PR adds a tooltip ("Enter an expression...") when there is no expression, and adds "Expression: " to the beginning of the tip when there is one (that was suggested by @kisolre).
I say "at first" because it turns out that the code for displaying that symbol and handling the tooltip is duplicated in five different classes spread out over three files. I could not bring myself to hardcode those strings in everyplace they would be needed, considering that it's very possible that the wording will be changed either now or in the future. So instead I added a new function to the ExpressionLabel class that encapsulates the new behavior. Unfortunately, doing so means I had to litter the code with dynamic casts, because we are storing a QLabel*, not an ExpressionLabel*.
I think once we begin the 0.20 development cycle I'd like to revisit this and do some refactoring to eliminate all the duplicated code, and the dynamic casts, but I don't want to do that just to implement this otherwise very simple feature.
[Merged] PR #4361: Add tooltip to f(x) when there is no expression
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Be nice to others! Respect the FreeCAD code of conduct!
Re: PR #4361: Add tooltip to f(x) when there is no expression
Thanks @chennes!
@realthunder does this PR conflict with your pending expression PR code at all?realthunder wrote: pinged by pinger macro
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Re: PR #4361: Add tooltip to f(x) when there is no expression
Shouldn't this better be left completely out of 0.19?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
Re: PR #4361: Add tooltip to f(x) when there is no expression
Yes, probably, I didn't read about the feature freeze until after I submitted the PR. My bad, sorry!
Re: PR #4361: Add tooltip to f(x) when there is no expression
Not necessarily as this gray-area since it's part of the documentation of FC.
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
-
- Veteran
- Posts: 2190
- Joined: Tue Jan 03, 2017 10:55 am
Re: PR #4361: Add tooltip to f(x) when there is no expression
I kind of implemented similar feature in my branch recently. Maybe you can take a look (main commit here, and there are a few follow ups). Most of handling of that icon is integrated into ExpressionLabel.
Re: PR #4361: Add tooltip to f(x) when there is no expression
That's great, I think that was the long-term answer: I was just trying to put together a quick low-impact PR. But since I've missed the feature freeze anyway it probably doesn't matter anymore.realthunder wrote: ↑Thu Feb 04, 2021 2:14 am Most of handling of that icon is integrated into ExpressionLabel.
Re: PR #4361: Add tooltip to f(x) when there is no expression
I prefer the way of showing the expression in the value: no need to hover with the mouse, and more than one expression visible at a time.
- Attachments
-
- Snip macro screenshot-c8b0bb.png (6.49 KiB) Viewed 5650 times
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.