Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the double click file renaming behavior on QTreeView and QFileSystemModel in PyQt?

Simple question. I'd like to use F2 or Enter for rename, and double click to open a file.

Using self.treeView.doubleClicked.connect(self.doubleclick) I can do things in my self.doubleClick method, but the renaming is still triggered.

The model is not read-only (model.setReadOnly(False)).

like image 619
iacopo Avatar asked Dec 21 '22 15:12

iacopo


1 Answers

I don't know if you have this in python versions, but in C++ Qt you just set the edit triggers in the QAbstractItemView:

void setEditTriggers ( EditTriggers triggers )

like image 91
gremwell Avatar answered Dec 28 '22 06:12

gremwell