Can i attach to QStandardItem check state a signal to know its state ? without subclassing.
-
"QStandardItemModel::itemChanged":http://doc.qt.nokia.com/latest/qstandarditemmodel.html#itemChanged
-
its not working for me .
here what i have :@connect(ui.treeView_mainwindow, SIGNAL(itemChanged( const QModelIndex &)), this,
SLOT(tree_itemChanged( const QModelIndex &)));// this function never fired when i check in/out
tree_itemChanged(const QModelIndex & index)
{QStandardItem* standardItem = m_model->itemFromIndex(index); Qt::CheckState checkState = standardItem->checkState(); if(checkState == Qt::Checked) { WRITELOG("Qt::Checked") } else if(checkState == Qt::Unchecked) { WRITELOG("Qt::Unchecked") }
}@
-
itemChanged is a signal from QStandardItemModel, not from (I think) a QTreeView
The signature is wrong as well (it passes a QStandardItem* and not a QModelIndex).
Tip: when developing, enable debug and check the console. A connect() that fails will return false and print a warning on the console.