darksaga
14th May 2007, 22:34
Hi,
I'm using a QSqlRelationalTableModel with two QSqlRelationalDelegates, comparable to the qt example: link (http://doc.trolltech.com/4.2/qsqlrelationaltablemodel.html)
In this example if I add a new City or Country (in the database), how do I tell the QSqlRelationalDelegates to update their data (tell the combobox to refresh the data)?
you can call something like
m_tableView->itemDelegate() to get a pointer to the QAbstractItemView but there's no method like refresh() or update().
Second question is:
Is it more efficient to implement a search for a QSqlRelationalTableModel using model->setFilter();model->select(); or is more performant to use a QSortFilterProxyModel between the QSqlRelationalTableModel and the QTableView e.g.:
QSqlRelationalTableModel model = new QSqlRelationalTableModel();
QSortFilterProxyModel proxyModel = new QSortFilterProxyModel();
proxyModel->setSourceModel(model );
QTableView tableView = new QTableView();
tableView->setModel(proxyModel );
I'm using a QSqlRelationalTableModel with two QSqlRelationalDelegates, comparable to the qt example: link (http://doc.trolltech.com/4.2/qsqlrelationaltablemodel.html)
In this example if I add a new City or Country (in the database), how do I tell the QSqlRelationalDelegates to update their data (tell the combobox to refresh the data)?
you can call something like
m_tableView->itemDelegate() to get a pointer to the QAbstractItemView but there's no method like refresh() or update().
Second question is:
Is it more efficient to implement a search for a QSqlRelationalTableModel using model->setFilter();model->select(); or is more performant to use a QSortFilterProxyModel between the QSqlRelationalTableModel and the QTableView e.g.:
QSqlRelationalTableModel model = new QSqlRelationalTableModel();
QSortFilterProxyModel proxyModel = new QSortFilterProxyModel();
proxyModel->setSourceModel(model );
QTableView tableView = new QTableView();
tableView->setModel(proxyModel );