In my Qt 5.6.2 project, I noticed that if you double click on a QTreeView
item (the actual arrow part, not the item text) the first click toggles the expanded state, and the second click does nothing.
I would instead like the second click to again toggle the expanded state.
I tried treeView->setExpandsOnDoubleClick(false);
but the behaviour is still the same since it appears to not affect the arrow part of the item at all. It looks like Qt is deciding for me how the arrow should react to a double click regardless of the property expandsOnDoubleClick
. How can I resolve this?
(Note: this behaviour didn't exist in Qt 5.0.2. Unsure about intermediate Qt versions.)
Qt
generally tries to follow a platform's 'expected' behaviour for this sort of user interaction, so deliberately going against that might not be a good idea. – G.M.