William Wilson
18th May 2009, 01:12
I have a QSqlQueryModel derived class and a QTableView derived class making use of Qt's model-view architecture to display data.
When the user double clicks on a row on the view, a dialog comes up and lets the user save a record. When the dialog is dismissed, I need to refresh the table view for just one row. I tried this by having a method in my derived model object:
void RefreshRows(const QModelIndex & topLeft, const QModelIndex & bottomRight)
{
dataChanged(topLeft, bottomRight);
}
I call this method after the dialog is dismissed:
pMyDerivedModel->RefreshRows(topLeft, bottomRight);
But the view's contents are not changed. Is this the right way to refresh one or more rows?
Thank you.
When the user double clicks on a row on the view, a dialog comes up and lets the user save a record. When the dialog is dismissed, I need to refresh the table view for just one row. I tried this by having a method in my derived model object:
void RefreshRows(const QModelIndex & topLeft, const QModelIndex & bottomRight)
{
dataChanged(topLeft, bottomRight);
}
I call this method after the dialog is dismissed:
pMyDerivedModel->RefreshRows(topLeft, bottomRight);
But the view's contents are not changed. Is this the right way to refresh one or more rows?
Thank you.