[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");
}@ -
Hi,
Where do you change your model data ?
-
Hi,
inside my class i have a function which creates the model based on data read from a file:
@
void MyClass::getProvider()
...
itemProvider = new QStandardItem(objStructProvider.Name);
modelProvider->appendRow(itemProvider);
itemProvider->setEditable(true);
...
@
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. -
Did you try the "itemChanged()-signal":http://qt-project.org/doc/qt-5.1/qtgui/qstandarditemmodel.html#itemChanged too?