Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
[SOLVED] QStandardItemModel's dataChanged signal doesn't get emitted
I have a QStandardItemModel attached to a QlistView, and i want to catch it's dataChanged signal however i can't. here is my code:
this code is inside the constructor:
@modelProvider = new QStandardItemModel(this);
bool rv = false;
rv = QObject::connect(modelProvider, SIGNAL(dataChanged(QModelIndex,QModelIndex)), this, SLOT(datachanged(QModelIndex,QModelIndex)));@
connect returns true in rv!
and here is my slot implementation:
@void MyClass::datachanged(QModelIndex index, QModelIndex index2)
QMessageBox::information(this, "test", "test");
Where do you change your model data ?
inside my class i have a function which creates the model based on data read from a file:
itemProvider = new QStandardItem(objStructProvider.Name);
and i want to catch dataChanged signal of model(modelProvider) when user has changed the item(itemProvider) text inside model(modelProvider).
by changing item text i mean: user double clicks on an item and the item enters editing state so that he can change it's text.
thx 4 ur reply.
thEClaw last edited by
Did you try the "itemChanged()-signal":http://qt-project.org/doc/qt-5.1/qtgui/qstandarditemmodel.html#itemChanged too?
The problem is solved!
i was initializing my Model for 2 times.