PDA

View Full Version : QCompleter does not call data method from model



luk_man_
14th July 2016, 14:32
Hi,

I done a model inherited from QStandardItemModel. It has QVector of items and overloads data and rowCount methods.
I fiil this model with some items and then i used setModel on QCompleter and setCompleter on a QLineEdit.

When i write some letters to QLineEdit the model does not work, it means that the data method is never call. Do you know what could be a reason of that behaviour?

BR,
Luca

d_stranz
14th July 2016, 16:05
it means that the data method is never call

How do you know? Did you run your program in the debugger and set a breakpoint at the start of the data() method?

By default, QCompleter calls data() only for column 0 of the model, and for the EditRole. Does your data method handle these?

anda_skoa
14th July 2016, 17:26
Maybe a stupid question, but why inherit from QStandardItemModel if you have your own data vector?

Cheers,
_