QSqlQueryModel downcasting problem !
Unsolved
General and Desktop
-
class Model : public QSqlQueryModel { QVariant data(const QModelIndex &item, int role = Qt::DisplayRole) const; }; QSqlQueryModel *model = new QSqlQueryModel(); model->setQuery("select * from table"); Model *derived = static_cast<QSqlQueryModel*>(model ); ui->tableView->setModel(derived); //not working
-
@_compiler said:
HiModel *derived = static_cast<QSqlQueryModel*>(model ); Should it not be Model *derived = static_cast<Model *>(model );
?
-
Hi,
To add to @mrjj, it should be
qobject_cast
1/4