Regarding overwritting the existing data in the QSqlRelationalTableModel



  • Qt 4.8
    Does the QSqlRelationalTableModel::setFilter() overwrite the existing data in the model?
    myModelModel->setFilter( QString("QueueID=%1 LIMIT %2 ,%3")
    .arg( m_QueueId )
    .arg( fromIndex )
    .arg( toIndex ) );
    if i call the myModelModel->rowCount(), it gives the total no. (existing + after filtered out).

    how to get overwritting, i want rowCount of the model same always.



  • QSqlRelationalTableModel::setFilter() works calling a select so it will rebuild the model. You could use or subclass QSortFilterProxyModel to do the filtering and retain the original model



  • @VRonin you mean after filtering out, existing data will be overritten.



  • yes, calling setfilter will call select using the filter argument as WHERE clause so resetting the whole model


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.