How do we simulate a double-click in the tree view?

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: How do we simulate a double-click in the tree view?

Post by openBrain »

ebrahim raeyat wrote: Sun Apr 18, 2021 8:47 am Thanks. I am a little confused. The DoubleClick method doesn't execute when double-clicking an object in a 3D scene? Thus, how can I execute it? Thanks.
You can't. FreeCAD offers no way to catch an action on the 3D view for a scripted object.
You should provide with your object a mechanism that would handle Qt/Coin mouse events in the 3D view. But that would be a terrible mess, maybe even not possible as FreeCAD already catch mouse events in its core.
ebrahim raeyat wrote: Sun Apr 18, 2021 8:54 am Thanks, But why I should not do that? I don't know. In most cased the user wants to click on an object in 3D, but with double-clicking in tree view, the user first must click on the object in 3D and then double-click on it in the tree. Because the user doesn't know the name of the object, most of the time.
Today FreeCAD handles clicks with 1 click select a geometry (face/edge/vertex) then second click selects the complete object, then third click the parent, and so on.
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: How do we simulate a double-click in the tree view?

Post by ebrahim raeyat »

openBrain wrote: Sun Apr 18, 2021 10:12 am You can't. FreeCAD offers no way to catch an action on the 3D view for a scripted object.
You should provide with your object a mechanism that would handle Qt/Coin mouse events in the 3D view. But that would be a terrible mess, maybe even not possible as FreeCAD already catch mouse events in its core.
Thanks. Is there any example of this type or trying to do similar work?
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: How do we simulate a double-click in the tree view?

Post by openBrain »

ebrahim raeyat wrote: Sun Apr 18, 2021 10:43 am Thanks. Is there any example of this type or trying to do similar work?
None that I know... :/
User avatar
ebrahim raeyat
Posts: 621
Joined: Sun Sep 09, 2018 7:00 pm
Location: Iran
Contact:

Re: How do we simulate a double-click in the tree view?

Post by ebrahim raeyat »

openBrain wrote: Sun Apr 18, 2021 6:19 pm
ebrahim raeyat wrote: Sun Apr 18, 2021 10:43 am Thanks. Is there any example of this type or trying to do similar work?
None that I know... :/
Thank you so much.
Post Reply