Changeset View
Changeset View
Standalone View
Standalone View
src/kdeclarative/qmlobject.cpp
Show All 12 Lines | |||||
13 | * | 13 | * | ||
14 | * You should have received a copy of the GNU Library General Public | 14 | * You should have received a copy of the GNU Library General Public | ||
15 | * License along with this program; if not, write to the | 15 | * License along with this program; if not, write to the | ||
16 | * Free Software Foundation, Inc., | 16 | * Free Software Foundation, Inc., | ||
17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | 17 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. | ||
18 | */ | 18 | */ | ||
19 | 19 | | |||
20 | #include "qmlobject.h" | 20 | #include "qmlobject.h" | ||
21 | #include "private/qmlobject_p.h" | | |||
22 | #include "private/kdeclarative_p.h" | 21 | #include "private/kdeclarative_p.h" | ||
23 | 22 | | |||
24 | #include <QQmlComponent> | 23 | #include <QQmlComponent> | ||
25 | #include <QQmlEngine> | 24 | #include <QQmlEngine> | ||
26 | #include <QQmlContext> | 25 | #include <QQmlContext> | ||
27 | #include <QQuickItem> | 26 | #include <QQuickItem> | ||
28 | #include <QQmlIncubator> | 27 | #include <QQmlIncubator> | ||
29 | #include <QTimer> | 28 | #include <QTimer> | ||
▲ Show 20 Lines • Show All 116 Lines • ▼ Show 20 Line(s) | 144 | : QObject(parent), | |||
146 | d(new QmlObjectPrivate(this)) | 145 | d(new QmlObjectPrivate(this)) | ||
147 | { | 146 | { | ||
148 | d->engine = new QQmlEngine(this); | 147 | d->engine = new QQmlEngine(this); | ||
149 | d->rootContext = d->engine->rootContext(); | 148 | d->rootContext = d->engine->rootContext(); | ||
150 | d->kdeclarative.setDeclarativeEngine(d->engine); | 149 | d->kdeclarative.setDeclarativeEngine(d->engine); | ||
151 | d->kdeclarative.d->qmlObj = this; | 150 | d->kdeclarative.d->qmlObj = this; | ||
152 | //binds things like kconfig and icons | 151 | //binds things like kconfig and icons | ||
153 | d->kdeclarative.setupBindings(); | 152 | d->kdeclarative.setupBindings(); | ||
154 | d->engine->setIncubationController(new QmlObjectIncubationController(this)); | | |||
155 | } | 153 | } | ||
156 | 154 | | |||
157 | QmlObject::QmlObject(QQmlEngine *engine, QObject *parent) | 155 | QmlObject::QmlObject(QQmlEngine *engine, QObject *parent) | ||
158 | : QObject(parent), | 156 | : QObject(parent), | ||
159 | d(new QmlObjectPrivate(this)) | 157 | d(new QmlObjectPrivate(this)) | ||
160 | { | 158 | { | ||
161 | if (engine) { | 159 | if (engine) { | ||
162 | d->engine = engine; | 160 | d->engine = engine; | ||
163 | } else { | 161 | } else { | ||
164 | d->engine = new QQmlEngine(this); | 162 | d->engine = new QQmlEngine(this); | ||
165 | d->engine->setIncubationController(new QmlObjectIncubationController(this)); | | |||
166 | } | 163 | } | ||
167 | d->rootContext = d->engine->rootContext(); | 164 | d->rootContext = d->engine->rootContext(); | ||
168 | d->kdeclarative.setDeclarativeEngine(d->engine); | 165 | d->kdeclarative.setDeclarativeEngine(d->engine); | ||
169 | d->kdeclarative.d->qmlObj = this; | 166 | d->kdeclarative.d->qmlObj = this; | ||
170 | //binds things like kconfig and icons | 167 | //binds things like kconfig and icons | ||
171 | d->kdeclarative.setupBindings(); | 168 | d->kdeclarative.setupBindings(); | ||
172 | } | 169 | } | ||
173 | 170 | | |||
174 | QmlObject::QmlObject(QQmlEngine *engine, QQmlContext *rootContext, QObject *parent) | 171 | QmlObject::QmlObject(QQmlEngine *engine, QQmlContext *rootContext, QObject *parent) | ||
175 | : QObject(parent), | 172 | : QObject(parent), | ||
176 | d(new QmlObjectPrivate(this)) | 173 | d(new QmlObjectPrivate(this)) | ||
177 | { | 174 | { | ||
178 | if (engine) { | 175 | if (engine) { | ||
179 | d->engine = engine; | 176 | d->engine = engine; | ||
180 | } else { | 177 | } else { | ||
181 | d->engine = new QQmlEngine(this); | 178 | d->engine = new QQmlEngine(this); | ||
182 | d->engine->setIncubationController(new QmlObjectIncubationController(0)); | | |||
183 | } | 179 | } | ||
184 | 180 | | |||
185 | if (rootContext) { | 181 | if (rootContext) { | ||
186 | d->rootContext = rootContext; | 182 | d->rootContext = rootContext; | ||
187 | } else { | 183 | } else { | ||
188 | d->rootContext = d->engine->rootContext(); | 184 | d->rootContext = d->engine->rootContext(); | ||
189 | } | 185 | } | ||
190 | d->kdeclarative.setDeclarativeEngine(d->engine); | 186 | d->kdeclarative.setDeclarativeEngine(d->engine); | ||
▲ Show 20 Lines • Show All 187 Lines • Show Last 20 Lines |