Details
-
Suggestion
-
Resolution: Out of scope
-
P4: Low
-
4.2.0
-
None
Description
You cannot set the QSqlDatabase object that QSqlTable model uses outside of the ctor.
I expected to see a method called:
QSqlTableModel::setTable( const QString &tableName, const QSqlDatabase &db );
E.g. like
QSqlQueryModel::setQuery(const QString &qry, const QSqlDatabase &db);
--------------------------------------------------------------------
Suggestion from open source community how to implement this:
qsqltablemodel.h
public:
void setDatabase( QSqlDatabase db );
qsqltablemodel.cpp
/*!
Sets the database connection to the one given.
*/
void QSqlTableModel::setDatabase( QSqlDatabase db )
{
Q_D(QSqlTableModel);
d->db = db.isValid() ? db : QSqlDatabase::database();
}
Attachments
Issue Links
- replaces
-
QTBUG-1863 Make it possible to modify the database used by a QSqlTableModel instance
-
- Closed
-