QTreeView initiates editing due to other triggers than the one configured, why?
-
I'm having the problem that the "edit":http://qt-project.org/doc/qt-5/qabstractitemview.html#edit-2 method of QTreeView is getting called due to other triggers than the one I have enabled, which is "SelectedClicked":http://qt-project.org/doc/qt-5/qabstractitemview.html#EditTrigger-enum. Why does this happen?
Below is an example of what I'm doling, if you try it you should see that edit gets called due to different triggers:
@
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtGui import *class TreeView(QTreeView):
def init(self):
super().init()
self.setEditTriggers(self.SelectedClicked)self.__model = QStandardItemModel() self.__model.appendRow([QStandardItem('Item 1')]) self.__model.appendRow([QStandardItem('Item 2')]) self.setModel(self.__model) def edit(self, index, trigger, event): print('Edit index {},{}, trigger: {}'.format(index.row(), index.column(), trigger)) return False
app = QApplication([])
w = TreeView()
w.show()
app.exec_()
@See also "my SO question":http://stackoverflow.com/questions/27169261/why-does-editing-in-qtreeview-get-initiated-by-other-triggers-than-the-one-i-hav on this topic.
-
Nevermind, I got an elucidating "answer":http://stackoverflow.com/a/27172458/265261.