[SOLVED] Remove tree view double click

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
DenysKovalenko
Posts: 12
Joined: Thu Oct 14, 2021 3:34 pm

[SOLVED] Remove tree view double click

Post by DenysKovalenko »

Hello Freecad forum, i need your help again:
Is there are any way to remove edit on tree view double click?
I tried to block signals from tree view but that doesn't help me...
Last edited by DenysKovalenko on Mon Nov 15, 2021 1:56 pm, edited 1 time in total.
openBrain
Veteran
Posts: 9041
Joined: Fri Nov 09, 2018 5:38 pm
Contact:

Re: Remove tree view double click

Post by openBrain »

With Python or C++?
DenysKovalenko
Posts: 12
Joined: Thu Oct 14, 2021 3:34 pm

Re: Remove tree view double click

Post by DenysKovalenko »

openBrain wrote: Thu Nov 11, 2021 12:44 pm With Python or C++?
Python
wmayer
Founder
Posts: 20310
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: Remove tree view double click

Post by wmayer »

Code: Select all

class IgnoreDoubleClick(QtCore.QObject):
  def eventFilter(self, obj, ev):
    if ev.type() == QtCore.QEvent.MouseButtonDblClick:
      return True
    return False

filter = IgnoreDoubleClick()
QtWidgets.QApplication.instance().installEventFilter(filter)
This will filter all double-click events not only that of the tree view.

Filtering double-click events only for the tree view seems a bit more difficult because the event is handled by a class QWidgetWindow instead of QTreeWidget.
chrisb
Veteran
Posts: 54223
Joined: Tue Mar 17, 2015 9:14 am

Re: Remove tree view double click

Post by chrisb »

DenysKovalenko wrote: Thu Nov 11, 2021 11:18 am Is there are any way to remove edit on tree view double click?
Not knowing what you are after, are you aware of the new possibility in 0.20 to configure the double click?
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
DenysKovalenko
Posts: 12
Joined: Thu Oct 14, 2021 3:34 pm

Re: Remove tree view double click

Post by DenysKovalenko »

wmayer wrote: Thu Nov 11, 2021 1:56 pm

Code: Select all

class IgnoreDoubleClick(QtCore.QObject):
  def eventFilter(self, obj, ev):
    if ev.type() == QtCore.QEvent.MouseButtonDblClick:
      return True
    return False

filter = IgnoreDoubleClick()
QtWidgets.QApplication.instance().installEventFilter(filter)
This will filter all double-click events not only that of the tree view.

Filtering double-click events only for the tree view seems a bit more difficult because the event is handled by a class QWidgetWindow instead of QTreeWidget.
Thanks for help
DenysKovalenko
Posts: 12
Joined: Thu Oct 14, 2021 3:34 pm

Re: Remove tree view double click

Post by DenysKovalenko »

chrisb wrote: Thu Nov 11, 2021 4:04 pm
DenysKovalenko wrote: Thu Nov 11, 2021 11:18 am Is there are any way to remove edit on tree view double click?
Not knowing what you are after, are you aware of the new possibility in 0.20 to configure the double click?
I didn't know about that, how i could configure the double click?
chrisb
Veteran
Posts: 54223
Joined: Tue Mar 17, 2015 9:14 am

Re: Remove tree view double click

Post by chrisb »

DenysKovalenko wrote: Mon Nov 15, 2021 1:55 pm I didn't know about that, how i could configure the double click?
There is a new drop down icon showing the current state. Sorry, not at my computer now, cannot show a picture.
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
chrisb
Veteran
Posts: 54223
Joined: Tue Mar 17, 2015 9:14 am

Re: [SOLVED] Remove tree view double click

Post by chrisb »

Here is the docs: Std_UserEditMode

Should this be added to the Std Base entry?
Roy_043 wrote: pinged by pinger macro
A Sketcher Lecture with in-depth information is available in English, auf Deutsch, en français, en español.
User avatar
Roy_043
Veteran
Posts: 8558
Joined: Thu Dec 27, 2018 12:28 pm

Re: [SOLVED] Remove tree view double click

Post by Roy_043 »

chrisb wrote: Mon Nov 15, 2021 5:25 pm Should this be added to the Std Base entry?
The Std_Base page is the main page for the Std commands. But most of those commands are not listed on that page, but on dedicated pages that exist for each of the main menus. The Std_Edit_Menu command can be found on the Std_Edit_Menu page.

Note that Std_Edit_Menu defines the edit mode when an object is double-clicked in the Tree view, it does not disable double-clicks.
Post Reply