PDA

View Full Version : QTreeView editing sometimes single click sometimes double click



ctgrund
17th May 2014, 22:09
Hi,

I use QTreeView::setEditTriggers(QAbstractItemView::AllE ditTriggers)

When I click on a item (1) -> editing starts (e.q. line edit)
When I click on a different item (2) -> editing starts
So far so good.
But:
When I click outside the frame an then again on item (2) -> need double click to start editing
I can simply start typing after single click but that's not what I want.

How can it be achieved that a single click on item (2) starts editing?

Thanks!
Thomas

Rajesh.Rathod
19th May 2014, 07:14
It can be a focus issue, when you click on tree view after clicking out side may be the first click just sets focus on QTreeView and then second click opens editable, you should try setting focus policy for QTreeView.

ctgrund
19th May 2014, 19:25
ALMOST solved. Thanks for the direction! After setting ItemIsSelectable the setting QAbstractItemView::SelectedClicked does most of the things.

One thing left: clicking on a selected item does start. BUT: clicking on selected but not active item starts editing only after about 0.5 seconds. This is not really good. Changing clicks beetween two items is ok. Editing starts immediately. But click-escape-click takes a while. Any hints??

Thanks so far!
Thomas