Frage

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?

Keine korrekte Lösung

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top