PR #1452 : Gui improvement : Drags and drops in tree view.

Have some feature requests, feedback, cool stuff to share, or want to know where FreeCAD is going? This is the place.
Forum rules
Be nice to others! Read the FreeCAD code of conduct!
plgarcia
Posts: 305
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: PR #1452 : Gui improvement : Drags and drops in tree view.

Postby plgarcia » Wed Jun 06, 2018 7:59 pm

Hello
Thank you for this information.
realthunder wrote:
Wed Jun 06, 2018 10:54 am
It is best suited as a context menu action in Part workbench if you want to use compound. However, IMO a draft clone is better suited for the job. And if my changes are accepted, Link is the ultimate solution, which I do have a command implemented as context menu action, called "Replace with link".
I did not know links. Is that a new functionality you are implementing?
A draft clone can be the solution for basic parts. But when the part is complex (fusions, intersections, extrusions, …) you do not want to duplicate the part. A clone is independent of the original. Changing the size of the original does not change the size of the clone, what is one of the dependences you may want to keep in your model.
It therefore depends on the type of part, and on the users’ wish.

realthunder wrote:
Wed Jun 06, 2018 10:54 am
Calling dropTarget->hasInInListRecursive(dragObj) is inefficient. You can obtain dragObj->outListRecursive() once at the beginning of dragging, and check if any dropTarget is in it.
I will change this OK.
realthunder wrote:
Wed Jun 06, 2018 10:54 am
In my branch, I added a new API called canDragAndDrop() to let object decide if the dropped object will be auto removed from the dragging target.
I do not agree on that position. Drag and Drop is a Gui concept. That is why I think canDrag and canDrop should be renamed in allowRemove and allowAdd or something equivalent. The object is not to know the reason why this operation is done and how it is done (by gui, scripting, …).
It is to the Gui to interrogate the parent object of the dragged object to know if it allows removing its son object, and only propose the actions to the user that respect this constraint.
It is also to the gui to interrogate the object destination object to know if adding an object is possible and restrict the possible actions to respect this constraint. This may end to no action is possible.
The user chooses between the different actions left by using the alteration keys.
That is what I implemented!
realthunder wrote:
Wed Jun 06, 2018 10:54 am
My Link object interpret the dropping action as setting the link path, which obviously should not remove the object from its parent. Besides, there are lots of other complications when dragging and dropping involves context, determined by dragging object's parent, and grandparents. But that's only in my branch, and doesn't concern you at the moment.
There should no interpretation. It is to the user to user to choose the operation among the possible operations.
Is everything is properly controlled, the action passed to the dropEvent function is clear:
Move (remove and add), Copy (only add), Link (make a link).
I used Qt::LinkAction to replace the target instead of adding to the target. May be should I extend the Qt::QTreeWidget to add the replace feature, so link will still be available for your purpose. It seems quite obvious that both or features cannot be implemented with the Qt::QTreeWidget as it is.
I do not know the effort needed for that, and there are decisions to be made on images added to cursor, keys to be used, possible combinations.
realthunder wrote:
Wed Jun 06, 2018 10:54 am
Finally, I suggest you check your file changes in github PR page, to avoid unnecessary changes due to line-ending problem. A lot of file is marked as completely changed.
I changed core.autocrlf to true. I hope this will solve the problem.
Let me know.
Regards
Pascal Garcia
realthunder
Posts: 1809
Joined: Tue Jan 03, 2017 10:55 am

Re: PR #1452 : Gui improvement : Drags and drops in tree view.

Postby realthunder » Wed Jun 06, 2018 11:57 pm

plgarcia wrote:
Wed Jun 06, 2018 7:59 pm
I did not know links. Is that a new functionality you are implementing?
If you are a Windows user, think it as the shortcut, for Linux, is works like symlink.

I do not agree on that position. Drag and Drop is a Gui concept. That is why I think canDrag and canDrop should be renamed in allowRemove and allowAdd or something equivalent. The object is not to know the reason why this operation is done and how it is done (by gui, scripting, …).
It is to the Gui to interrogate the parent object of the dragged object to know if it allows removing its son object, and only propose the actions to the user that respect this constraint.
The parent object is certainly the first to consult whether its children can be dragged out. But the dropping object should also be able to decide whether it want to accept the object as a child. In your case, you have added a new concept of LinkAction, which can be used here to distinguish this case, and I like that. Although, in a usability point of view, the user is now forced to be aware of this distinction, and must press some short-key to activate that, even though for some object, only one action makes sense. I can't really decide if this is consider not user friendly.
Try Assembly3 (latest version 0.11) along with my custom build of FreeCAD at here.
And if you'd like to show your support, you can donate through patreon, liberapay, or paypal
plgarcia
Posts: 305
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: PR #1452 : Gui improvement : Drags and drops in tree view.

Postby plgarcia » Thu Jun 07, 2018 10:40 pm

realthunder wrote:
Wed Jun 06, 2018 11:57 pm
If you are a Windows user, think it as the shortcut, for Linux, is works like symlink.
Yes I am a Windows user because I am working in a 20000 people firm that made the realistic choice to provide Windows on the desktop for its staff, and one must admit that Windows was more stable, and more hardware than Linux, and some tools I am using on daily basis have not equivalent on others platform. This slowly evolves.
Know I am also a Unix and linux user.
Let us say that this misunderstanding comes to the fact that English is not my native language.
I was speaking in the context of FreeCAD. Are you implementing a concept of links in the FreeCAD, and if not what are you referring to links!
realthunder wrote:
Wed Jun 06, 2018 11:57 pm
The parent object is certainly the first to consult whether its children can be dragged out. But the dropping object should also be able to decide whether it want to accept the object as a child. In your case, you have added a new concept of LinkAction, which can be used here to distinguish this case, and I like that. Although, in a usability point of view, the user is now forced to be aware of this distinction, and must press some short-key to activate that, even though for some object, only one action makes sense. I can't really decide if this is consider not user friendly.
This behavior using keys is standard. I use it in KDE on Linux, and on windows. It is directly implemented in Qt with systems specific behaviors. Standard and conformant to all systems!
When you want to make a cut between 2 parts :
  • You click on the first part
  • You press <Ctrl> key
  • Then click on the second part
  • Release <Ctrl> key
  • click on the right icon in part workbench
You already use alteration keys.

I insist on what if wrote I the previous post a new function canDragAndDrop is not useful, and I refined a bit the description of QTreeView in the document on the drive.

regards
Pascal Garcia
Last edited by plgarcia on Sun Jun 24, 2018 8:06 am, edited 1 time in total.
plgarcia
Posts: 305
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: PR #1452 : Gui improvement : Drags and drops in tree view.

Postby plgarcia » Sun Jun 10, 2018 10:21 pm

Hello,
I have changed the code to prepare further organizations of the code.
I have also produced 2 new videos to explain the problems in present development, ad to present the new behavior.

Somme errors in the present version, and the new proposed behavior.
https://drive.google.com/open?id=1ZmaVT ... T3kbaECrvi
https://drive.google.com/open?id=1bY-4r ... OFVw3NmTgD


I really like this PR to be taken. I use it for my personnel development and I can really use drag and drop what is not possible in the current version because of bugs.

Regards
Pascal Garcia
plgarcia
Posts: 305
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: PR #1452 : Gui improvement : Drags and drops in tree view.

Postby plgarcia » Wed Jun 20, 2018 7:38 am

Hello folks!
With the last videos, I brought the proof there has been an attempt to implement drags and drops in FreeCAD tree views, and that this function have bugs that conduct to introduce inconsistencies in documents.

I propose an implementation that solves these problems and extends functionalities on the TreeView. I personally work on a version of FreeCAD I compile by my own, because I am quite fond of drag and drops I use quite exclusively to reorganize the model. I did not found yet any problem around this.

I really do not see why this PR is not taken as it replaces something that is not working at all. Furthermore I could have feedbacks on potential bugs of usage cases. I promise I will provide all support to document it and to correct any bug that could be found.
What else should I do?
Regards
Pascal Garcia
Jee-Bee
Posts: 2145
Joined: Tue Jun 16, 2015 10:32 am
Location: Netherlands

Re: PR #1452 : Gui improvement : Drags and drops in tree view.

Postby Jee-Bee » Wed Jun 20, 2018 8:02 am

Ping WMayer
chrisb
Posts: 29010
Joined: Tue Mar 17, 2015 9:14 am

Re: PR #1452 : Gui improvement : Drags and drops in tree view.

Postby chrisb » Wed Jun 20, 2018 10:23 pm

This is not a trivial pull request, so it may take it's time.
I can imagine how you feel, because some time ago I had waited almost desperately for some changes of Abdullah. I saw it getting out of sync and I became more and more nervous - but finally it was mered.

It's done when it's done.
A Sketcher Lecture with in-depth information is available in English, auf deutsch, en français, en español.
plgarcia
Posts: 305
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: PR #1452 : Gui improvement : Drags and drops in tree view.

Postby plgarcia » Mon Jul 09, 2018 1:23 pm

Hello,
Sorry it is not complex, it concerns the knowledge of Qt. It is not wide either. Furthermore, I take the time to understand how the software works and I document and explain all what I am doing what almost nobody else does. I do not understand, and I simply have the impression I loose time and efforts.

But that is OK for me. I use daily the version I built, and it completely satisfies me for what I need. I can wait.
This also led me to stop working on colors management and performances. Everybody knows there are performances issues visible when animating a model, and that colors are lost.

These changes are complex and need some redesign of the software and will induce changes in many classes. For safety and control reasons, this should be done in many steps, and I doubt I could have structuring PR accepted if the design has not been discussed before. Furthermore, if in between two steps I have to wait many months as I do now, how many years will it take to have these colors and performances changes completed. None of the request to have access to somebody to validate the changes I foresee to implement have been answered. If someday the designers are interested in improving the performances, and solve this color management issues, I will be happy to share my analysis with them. If they want me to help them implementing the changes, they will just have to let me know, I will appreciate to do it in a controlled process.

Regards
Pascal Garcia
plgarcia
Posts: 305
Joined: Wed Jun 17, 2015 9:47 pm
Location: Near Paris (France)

Re: PR #1452 : Gui improvement : Drags and drops in tree view.

Postby plgarcia » Fri Aug 10, 2018 3:16 pm

I merged and solved conflicts.
Regards
Pascal Garcia
User avatar
bernd
Posts: 10973
Joined: Sun Sep 08, 2013 8:07 pm
Location: Zürich, Switzerland

Re: PR #1452 : Gui improvement : Drags and drops in tree view.

Postby bernd » Sat Aug 11, 2018 9:51 am

plgarcia wrote:
Fri Aug 10, 2018 3:16 pm
I merged and solved conflicts.
Regards
Pascal Garcia
and rebased on master! Thats a good idea if you gone wait for integration in master !