Tree automatically expanded upon opening of FCStd file

About the development of the Part Design module/workbench. PLEASE DO NOT POST HELP REQUESTS HERE!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Tree automatically expanded upon opening of FCStd file

Post by NormandC »

Hello,

With FreeCAD compiled from the master branch, when I open a file everything is automatically expanded in the Project tree. See capture below:

Image

Up to 0.13.1830 it didn't do that. Is that intended? I find this really annoying, and it hampers my work flow. When I have many Part Design features, previously they would all show up in the tree, thus could be located quickly. Now I have to scroll down to get to the bottom. And I have a 1920x1200px screen!
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Tree automatically expanded upon opening of FCStd file

Post by jriegel »

Mhh,
I'm not aware we changed something there. Was there a switch of Qt on your platform?

Generally I think we should maybe save the status of the tree items with the ViewProviders, so we can preserve the tree state....
Stop whining - start coding!
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Tree automatically expanded upon opening of FCStd file

Post by NormandC »

I am not aware there was a switch. In any case, on the same system I have 0.13.1830 installed from the stable PPA and it doesn't do that.
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Tree automatically expanded upon opening of FCStd file

Post by wmayer »

This behaviour has been introduced with the merge of the assembly-dev branch https://sourceforge.net/p/free-cad/code ... e=1#diff-5
When a property of an object changes we explicitly expand the item in the tree view inside the method DocumentItem::slotChangeObject() And since on project load all properties of all objects get touched we have a fully expanded tree view afterwards.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Tree automatically expanded upon opening of FCStd file

Post by NormandC »

Yes even creating a new file the tree is expanded by default which I find annoying as hell. I mostly use the stable version because of that.
User avatar
jriegel
Founder
Posts: 3369
Joined: Sun Feb 15, 2009 5:29 pm
Location: Ulm, Germany
Contact:

Re: Tree automatically expanded upon opening of FCStd file

Post by jriegel »

I would say we add a Bool property to the ViewProvider base class which define the status of the tree (expanded or not). So one can define on creation if its should be open or not and the status gets saved..

@Werner
You have time to do it?
Stop whining - start coding!
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Tree automatically expanded upon opening of FCStd file

Post by wmayer »

git show a233388

IMO having a PropertyBool to store this information is waste of memory because it needs 4 bytes extra for every object. So, I decided to reserve one bit of our bitset of the DocumentObject where this information can be kept. Then when saving a document an XML attribute "expanded" is written to the ViewProvider tag in the GuiDocument.xml file. This way we don't need any extra memory at all.
User avatar
NormandC
Veteran
Posts: 18589
Joined: Sat Feb 06, 2010 9:52 pm
Location: Québec, Canada

Re: Tree automatically expanded upon opening of FCStd file

Post by NormandC »

Werner,

Thank you so much! :)
Post Reply