summaryrefslogtreecommitdiffstats
path: root/src/declarative/extra/qmlsqlconnection.cpp
diff options
context:
space:
mode:
authorAaron Kennedy <aaron.kennedy@nokia.com>2009-04-27 05:36:11 (GMT)
committerAaron Kennedy <aaron.kennedy@nokia.com>2009-04-27 05:36:11 (GMT)
commit9f941fd65083ae6d3f2f5441bf60346821932218 (patch)
tree4ccd25dd9de4835a551534de37a931e2105fa4d3 /src/declarative/extra/qmlsqlconnection.cpp
parentf75b524b060682a896ac7a3951ac677d29e15727 (diff)
downloadQt-9f941fd65083ae6d3f2f5441bf60346821932218.zip
Qt-9f941fd65083ae6d3f2f5441bf60346821932218.tar.gz
Qt-9f941fd65083ae6d3f2f5441bf60346821932218.tar.bz2
Add a declarative data ptr to QObjectPrivate
This data ptr does not increase the size of the QObject, as we take advantage of space only used during destruction. Currently this data is only used to store an object's QmlContext, but it will be used for more later.
Diffstat (limited to 'src/declarative/extra/qmlsqlconnection.cpp')
-rw-r--r--src/declarative/extra/qmlsqlconnection.cpp8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/declarative/extra/qmlsqlconnection.cpp b/src/declarative/extra/qmlsqlconnection.cpp
index 3e2032c..7f1fec2 100644
--- a/src/declarative/extra/qmlsqlconnection.cpp
+++ b/src/declarative/extra/qmlsqlconnection.cpp
@@ -62,7 +62,6 @@ public:
int port;
QString name, databaseName, connectionOptions;
QString hostName, userName, password, driver;
- QmlContext *context;
};
/*!
@@ -177,8 +176,6 @@ public:
QmlSqlConnection::QmlSqlConnection(QObject *parent)
: QObject(*(new QmlSqlConnectionPrivate), parent)
{
- Q_D(QmlSqlConnection);
- d->context = QmlContext::activeContext();
}
/*!
@@ -416,10 +413,11 @@ QSqlDatabase QmlSqlConnection::database() const
}
if (db.isOpen())
return db;
- if ((d->driver.isEmpty() || d->driver == QLatin1String("QSQLITE")) && d->context) {
+ if ((d->driver.isEmpty() || d->driver == QLatin1String("QSQLITE")) &&
+ qmlContext(this)) {
// SQLITE uses files for databases, hence use relative pathing
// if possible.
- QUrl url = d->context->resolvedUrl(d->databaseName);
+ QUrl url = qmlContext(this)->resolvedUrl(d->databaseName);
if (url.isRelative() || url.scheme() == QLatin1String("file"))
db.setDatabaseName(url.toLocalFile());
else