I have a QTreeWidget for which I want double click to open a specific thing and single click to start renaming of the item, but I don’t want both actions to happen when I double click. Right now when I double click my tree item I get my things to load and the item gets in a renaming state.
I am using the following statements to set my QTreeWidget:
this->setEditTriggers(
QAbstractItemView::EditKeyPressed
| QAbstractItemView::SelectedClicked
);
connect(
this, SIGNAL(itemDoubleClicked(QTreeWidgetItem*, int)),
this, SLOT(OnMouseDoubleClicked(QTreeWidgetItem*, int))
);
Is there something specific I could do to prevent the item to get in a renaming/edit state when I double click on it since I only want my custom loading action to happen, but still keep in-place edit when I single click an element in the tree?
this->setExpandsOnDoubleClick(false)
and accept your own answer. It's not eternally binding; someone who comes along later with an alternative viewpoint can add it, you can accept it. But closing a question gets it out of "unanswered" searches. – HostileFork says dont trust SE