https://stackoverflow.com/a/22379130/21860235[the post 8 years ago][1]
Hello, I would like to understand what is the trolltech modelest
that he disabled in order to have a fast datachanged.emit(QModelIndex(), QModelIndex())
signal. I don't have a lot of items in my QTreeView
, so it shouldn't take 0,1 seconds each time this signal
is emitted.
Edit
As I said in the comment section, when I remove this line : self.model.dataChanged.connect(self.onDataChanged)
the program works as fast as excpected. This method is not big at all, I only use it to update data in my database (the model is built on this database).
def onDataChanged(self) :
item_id = self.currentIndex().siblingAtColumn(1).data()
if self.currentIndex().isValid() :
new_name = self.currentIndex().siblingAtColumn(0).data()
con : Connexion() = Connexion()
con.update("UPDATE cdc SET nom = :1 WHERE ID = :2",[new_name,item_id])
self.update()
The object con
comes from a class that connects to my database. I tested many queries and they all are fast to commit (less than 0,01 second) so I'm pretty sure the problem does not come from there. So I am wondering if implementing my own dataChanged function is altering Qt's functionnalities ?
Thanks for your answers