You can update your QRelationalTableModel by using QSqlRelationalTableModel::setFilter()
for example:
void Widget::priceListIndexChanged(int index)
{
int priceListId = priceListModel->index(index, 0).data(Qt::DisplayRole).toInt();
productModel
->setFilter
(QString("%1.pricelistid=%2").
arg(productModel
->tableName
()).
arg(priceListId
));
productModel->select();
}
void Widget::priceListIndexChanged(int index)
{
int priceListId = priceListModel->index(index, 0).data(Qt::DisplayRole).toInt();
productModel->setFilter(QString("%1.pricelistid=%2").arg(productModel->tableName()).arg(priceListId));
productModel->select();
}
To copy to clipboard, switch view to plain text mode
Bookmarks