enthought / enthought/traitsui

Qt TreeEditor sets editable flags during check for editability(!)

Open
#1,672 0 comments 0 reactions 0 assignees View on GitHub
difficulty: advanced toolkit: Qt type: bug type: important
Dominant language
Python
Stars
306
Forks
99
PR merge metrics
No merged PRs in 30d

Description

This method:
https://github.com/enthought/traitsui/blob/0c30b77bc5cf6ba8aa4512f4e32834da269c83c4/traitsui/qt4/tree_editor.py#L1116-L1134
is invoked by the tree editor's `Rename` context menu item.

As a side-effect, it _sets_ the editable flag of the item. As a general rule, simple checks shouldn't have side-effects like this.

Almost certainly, this flag should instead be being set when the item is created (or if editability can change, should have infrastructure to watch for the changes and set the editability as needed).

The current design leads to weird effects, such as typing "Return" when an item is selected does nothing, unless the user does a right-click to get a context menu which includes the "Rename" menu item, after which "Return" opens the label for editing (even if nothing was selected in the context menu).

One possible thing that will need to be checked is whether fixing this breaks double-click handling for editable items.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.