Leader Line issues

Discussions about the development of the TechDraw workbench
User avatar
uwestoehr
Posts: 1366
Joined: Sun Jan 27, 2019 3:21 am

Leader Line issues

Postby uwestoehr » Sat Jan 25, 2020 12:33 pm

I think there are some issues in the Leader Line feature (some are the same as for the RichTextAnnotation: https://forum.freecadweb.org/viewtopic.php?f=35&t=42746):

stroke through items are meanwhile resolved

  • Create a new line . Select the line in the tree and go to the View properties tab. There change the color of the line
    -> result: nothing happens
    select another element in the tree
    -> result: now the changed color is shown
    This bug also happens for Line Style and Line Width
  • Select the line in the tree and go to the View properties tab. The frame setting Line Style has numbers. But since this settings offers line styles, it should instead of a number be a combo box showing like in the line dialog:
    LeaderLine-dialog.png
    Leader line dialog
    LeaderLine-dialog.png (11.54 KiB) Viewed 312 times
    This way it is assured that the user cannot e.g. enter "6" as there are only 5 styles available. -> one can now only set in the range 0 - 5
  • The Line Width setting has no unit. It is millimeter -> I'll try to make a PR
  • Open the line dialog by double-clicking on the line in the tree. Set there the Style to "NoLine". Then close the dialog, select the line in the tree and go to the View properties tab.
    -> result: the entry for the line style is enabled despite there is no line. It should therefore be disabled.
    -> not sensible to implement this
OS: Windows 7 SP 1 (6.1)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.19363 (Git)
Build type: Release
Branch: master
Hash: e434d1145de6e964deca65698c4a162c331f52b5
Python version: 3.6.8
Qt version: 5.12.1
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: German/Germany (de_DE)
Last edited by uwestoehr on Wed Jan 29, 2020 11:03 pm, edited 1 time in total.
User avatar
wandererfan
Posts: 3669
Joined: Tue Nov 06, 2012 5:42 pm

Re: Leader Line issues

Postby wandererfan » Sat Jan 25, 2020 3:48 pm

uwestoehr wrote:
Sat Jan 25, 2020 12:33 pm
  • Create a new line . Select the line in the tree and go to the View properties tab. There change the color of the line
    -> result: nothing happens
    select another element in the tree
    -> result: now the changed color is shown
    This bug also happens for Line Style and Line Width
missing 'recomputes" and/or "paintRequests". possibly onChanged in the ViewProvider.
[*] Select the line in the tree and go to the View properties tab. The frame setting Line Style has numbers. But since this settings offers line styles, it should instead of a number be a combo box showing like in the line dialog:
LeaderLine-dialog.png
This way it is assured that the user cannot e.g. enter "6" as there are only 5 styles available.
This is only available in the property editor for PropertyEnumeration. So that's a property type change for LineStyle.
[*] Open the line dialog by double-clicking on the line in the tree. Set there the Style to "NoLine". Then close the dialog, select the line in the tree and go to the View properties tab.
-> result: the entry for the line style is enabled despite there is no line. It should therefore be disabled.
[/list]
NoLine is a valid style (call it invisible or hidden or ???). I you disable the line style property, how are you going to put it back to Solid when you change your mind?

I won't get to these for a little while, I think.
User avatar
uwestoehr
Posts: 1366
Joined: Sun Jan 27, 2019 3:21 am

Re: Leader Line issues

Postby uwestoehr » Sat Jan 25, 2020 4:39 pm

wandererfan wrote:
Sat Jan 25, 2020 3:48 pm
missing 'recomputes" and/or "paintRequests". possibly onChanged in the ViewProvider.
It seems so.
This is only available in the property editor for PropertyEnumeration. So that's a property type change for LineStyle.
Yes.
NoLine is a valid style (call it invisible or hidden or ???). I you disable the line style property, how are you going to put it back to Solid when you change your mind?
I won't get to these for a little while, I think.
You misunderstood. What I think is correct:
- User set a line style that is NOT NoLine -> property Line Style is enabled
- User set line style NoLine -> property Line Style is disabled
User avatar
uwestoehr
Posts: 1366
Joined: Sun Jan 27, 2019 3:21 am

Re: Leader Line issues

Postby uwestoehr » Sat Jan 25, 2020 5:55 pm

uwestoehr wrote:
Sat Jan 25, 2020 4:39 pm
- User set a line style that is NOT NoLine -> property Line Style is enabled
- User set line style NoLine -> property Line Style is disabled
I managed to implement it but see now that this is not sensible.
User avatar
uwestoehr
Posts: 1366
Joined: Sun Jan 27, 2019 3:21 am

Re: Leader Line issues

Postby uwestoehr » Sun Jan 26, 2020 2:06 am

wandererfan wrote:
Sat Jan 25, 2020 3:48 pm
missing 'recomputes" and/or "paintRequests". possibly onChanged in the ViewProvider.
With this PR: https://github.com/FreeCAD/FreeCAD/pull/2939 the change to the line color is now immediately applied.

But when one changes the Line Width, this change is still not immediately applied. It will however be applied when changing the the line color subsequently (not necessary to actually change it, calling the color dialog is sufficient). It seems that just changing the Line Width does not call the onChanged function while calling the color dialog does. Do you have an idea why this is the case?

---------

Another question: I need to know is a Draw***.cpp what the value of a property is that is added in the Viewprovider***.cpp file. How can I achieve this? I tried to include the Viewprovider***.h file in Draw***.cpp but just the include gives me compilation errors.
User avatar
uwestoehr
Posts: 1366
Joined: Sun Jan 27, 2019 3:21 am

Re: Leader Line issues

Postby uwestoehr » Sun Jan 26, 2020 5:17 pm

uwestoehr wrote:
Sat Jan 25, 2020 12:33 pm
The frame setting Line Style has numbers....
At the moment the user can there enter e.g. "6" but there are only 5 styles available.
This is fixed by the PR: https://github.com/FreeCAD/FreeCAD/pull/2942
User avatar
wandererfan
Posts: 3669
Joined: Tue Nov 06, 2012 5:42 pm

Re: Leader Line issues

Postby wandererfan » Sun Jan 26, 2020 6:05 pm

uwestoehr wrote:
Sun Jan 26, 2020 2:06 am
But when one changes the Line Width, this change is still not immediately applied. It will however be applied when changing the the line color subsequently (not necessary to actually change it, calling the color dialog is sufficient). It seems that just changing the Line Width does not call the onChanged function while calling the color dialog does. Do you have an idea why this is the case?
Are you using the dialog or the PropertyEditor to change the LineWidth?
Another question: I need to know is a Draw***.cpp what the value of a property is that is added in the Viewprovider***.cpp file. How can I achieve this? I tried to include the Viewprovider***.h file in Draw***.cpp but just the include gives me compilation errors.
Ahh, you've run into the great FC divide between App and Gui! Gui is allowed to call App, but App is not allowed to call Gui. This is so App can run without Gui in headless mode. It doesn't really work for TD since so much is graphical, but we try to obey the principle.
User avatar
uwestoehr
Posts: 1366
Joined: Sun Jan 27, 2019 3:21 am

Re: Leader Line issues

Postby uwestoehr » Sun Jan 26, 2020 6:09 pm

wandererfan wrote:
Sun Jan 26, 2020 6:05 pm
Are you using the dialog or the PropertyEditor to change the LineWidth?
The bug I fixed is only when changing the LineWidth via the PropertyEditor.
User avatar
wandererfan
Posts: 3669
Joined: Tue Nov 06, 2012 5:42 pm

Re: Leader Line issues

Postby wandererfan » Sun Jan 26, 2020 7:20 pm

uwestoehr wrote:
Sun Jan 26, 2020 6:09 pm
The bug I fixed is only when changing the LineWidth via the PropertyEditor.
This fixes the immediate update issue:

Code: Select all

@@ -404,6 +404,7 @@ void QGILeaderLine::draw()
     } else {
         setPrettyNormal();
     }
+    update(boundingRect());
 }
You're not supposed to need to call update(), but I guess color and linewidth aren't considered "geometry changes" by Qt.

This one fixes a typo in the parameter group name:

Code: Select all

@@ -584,8 +585,9 @@ double QGILeaderLine::getEdgeFuzz(void) const
 QColor QGILeaderLine::getNormalColor()
 {
 //    Base::Console().Message("QGILL::getNormalColor()\n");
-    Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter()
-                                        .GetGroup("BaseApp")->GetGroup("Preferences")->GetGroup("Mod/TechDraw/LeaderLinens]");
+    Base::Reference<ParameterGrp> hGrp = App::GetApplication().GetUserParameter().
+                                         GetGroup("BaseApp")->GetGroup("Preferences")->
+                                         GetGroup("Mod/TechDraw/LeaderLines");
     App::Color fcColor;
User avatar
uwestoehr
Posts: 1366
Joined: Sun Jan 27, 2019 3:21 am

Re: Leader Line issues

Postby uwestoehr » Sun Jan 26, 2020 9:57 pm

wandererfan wrote:
Sun Jan 26, 2020 7:20 pm
This one fixes a typo in the parameter group name:...
Thanks! This explains the problems I had. Now the issue is completely solved. I updated my PR accordingly.
wandererfan wrote:
Sun Jan 26, 2020 7:20 pm
This fixes the immediate update issue:...
I don't know about the internals. What i did was just what i see for other TD components and they do a QGIView updateView(true).