summaryrefslogtreecommitdiffstats
path: root/src/sql/models/qsqlquerymodel.cpp
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2011-02-15 16:10:20 (GMT)
committerGabriel de Dietrich <gabriel.dietrich-de@nokia.com>2011-02-15 16:10:20 (GMT)
commit96abeb8021c48f9651b6a5c62b7cb427b2bc8ccf (patch)
tree69a2ed4ce05b1839d6e050668273c70245076d68 /src/sql/models/qsqlquerymodel.cpp
parenta38a14b9fb411231443e80cf14d397492f3412dc (diff)
parent0a24d2d6269d509e775f7da91c8002eddc2dcbd7 (diff)
downloadQt-96abeb8021c48f9651b6a5c62b7cb427b2bc8ccf.zip
Qt-96abeb8021c48f9651b6a5c62b7cb427b2bc8ccf.tar.gz
Qt-96abeb8021c48f9651b6a5c62b7cb427b2bc8ccf.tar.bz2
Merge branch 'master-upstream'
Diffstat (limited to 'src/sql/models/qsqlquerymodel.cpp')
-rw-r--r--src/sql/models/qsqlquerymodel.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/sql/models/qsqlquerymodel.cpp b/src/sql/models/qsqlquerymodel.cpp
index 8730192..d1051de 100644
--- a/src/sql/models/qsqlquerymodel.cpp
+++ b/src/sql/models/qsqlquerymodel.cpp
@@ -279,7 +279,11 @@ QVariant QSqlQueryModel::headerData(int section, Qt::Orientation orientation, in
val = d->headers.value(section).value(Qt::EditRole);
if (val.isValid())
return val;
- if (role == Qt::DisplayRole && d->rec.count() > section)
+
+ // See if it's an inserted column (iiq.column() != -1)
+ QModelIndex dItem = indexInQuery(createIndex(0, section));
+
+ if (role == Qt::DisplayRole && d->rec.count() > section && dItem.column() != -1)
return d->rec.fieldName(section);
}
return QAbstractItemModel::headerData(section, orientation, role);
@@ -306,6 +310,8 @@ void QSqlQueryModel::queryChange()
lastError() can be used to retrieve verbose information if there
was an error setting the query.
+ \note Calling setQuery() will remove any inserted columns.
+
\sa query(), QSqlQuery::isActive(), QSqlQuery::setForwardOnly(), lastError()
*/
void QSqlQueryModel::setQuery(const QSqlQuery &query)
@@ -370,7 +376,8 @@ void QSqlQueryModel::setQuery(const QSqlQuery &query)
/*! \overload
Executes the query \a query for the given database connection \a
- db. If no database is specified, the default connection is used.
+ db. If no database (or an invalid database) is specified, the
+ default connection is used.
lastError() can be used to retrieve verbose information if there
was an error setting the query.