Qt 4.8
qdeclarativecomponent.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtDeclarative module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 #include "qdeclarativecomponent.h"
43 #include "private/qdeclarativecomponent_p.h"
44 
45 #include "private/qdeclarativecompiler_p.h"
46 #include "private/qdeclarativecontext_p.h"
47 #include "private/qdeclarativeengine_p.h"
48 #include "private/qdeclarativevme_p.h"
49 #include "qdeclarative.h"
50 #include "qdeclarativeengine.h"
51 #include "private/qdeclarativebinding_p.h"
52 #include "private/qdeclarativebinding_p_p.h"
53 #include "private/qdeclarativeglobal_p.h"
54 #include "private/qdeclarativescriptparser_p.h"
55 #include "private/qdeclarativedebugtrace_p.h"
56 #include "private/qdeclarativeenginedebugservice_p.h"
57 #include <QtScript/qscriptvalueiterator.h>
58 
59 #include <QStack>
60 #include <QStringList>
61 #include <QtCore/qdebug.h>
62 #include <QApplication>
63 #include <qdeclarativeinfo.h>
64 
66 
67 class QByteArray;
68 
257 {
259 
261 
263  typeData = 0;
264 
265  emit q->statusChanged(q->status());
266 }
267 
269 {
271 
272  progress = p;
273 
274  emit q->progressChanged(p);
275 }
276 
278 {
279  url = data->finalUrl();
281 
282  if (!c) {
283  Q_ASSERT(data->isError());
284  state.errors = data->errors();
285  } else {
286  cc = c;
287  }
288 
289  data->release();
290 }
291 
293 {
294  if (typeData) {
296  typeData->release();
297  typeData = 0;
298  }
299 
300  if (cc) {
301  cc->release();
302  cc = 0;
303  }
304 }
305 
310  : QObject(*(new QDeclarativeComponentPrivate), parent)
311 {
312 }
313 
318 {
320 
321  if (d->state.completePending) {
322  qWarning("QDeclarativeComponent: Component destroyed while completion pending");
323  d->completeCreate();
324  }
325 
326  if (d->typeData) {
327  d->typeData->unregisterCallback(d);
328  d->typeData->release();
329  }
330  if (d->cc)
331  d->cc->release();
332 }
333 
357 {
358  Q_D(const QDeclarativeComponent);
359 
360  if (d->typeData)
361  return Loading;
362  else if (!d->state.errors.isEmpty())
363  return Error;
364  else if (d->engine && d->cc)
365  return Ready;
366  else
367  return Null;
368 }
369 
374 {
375  return status() == Null;
376 }
377 
382 {
383  return status() == Ready;
384 }
385 
390 {
391  return status() == Error;
392 }
393 
398 {
399  return status() == Loading;
400 }
401 
420 {
421  Q_D(const QDeclarativeComponent);
422  return d->progress;
423 }
424 
450  : QObject(*(new QDeclarativeComponentPrivate), parent)
451 {
453  d->engine = engine;
454 }
455 
466 : QObject(*(new QDeclarativeComponentPrivate), parent)
467 {
469  d->engine = engine;
470  loadUrl(url);
471 }
472 
480  QObject *parent)
481 : QObject(*(new QDeclarativeComponentPrivate), parent)
482 {
484  d->engine = engine;
485  loadUrl(d->engine->baseUrl().resolved(QUrl::fromLocalFile(fileName)));
486 }
487 
492  : QObject(*(new QDeclarativeComponentPrivate), parent)
493 {
495  d->engine = engine;
496  d->cc = cc;
497  cc->addref();
498  d->start = start;
499  d->count = count;
500  d->url = cc->url;
501  d->progress = 1.0;
502 }
503 
510 {
512 
513  d->clear();
514 
515  d->url = url;
516 
517  QDeclarativeTypeData *typeData = QDeclarativeEnginePrivate::get(d->engine)->typeLoader.get(data, url);
518 
519  if (typeData->isCompleteOrError()) {
520  d->fromTypeData(typeData);
521  } else {
522  d->typeData = typeData;
523  d->typeData->registerCallback(d);
524  }
525 
526  d->progress = 1.0;
528  emit progressChanged(d->progress);
529 }
530 
536 {
537  Q_D(const QDeclarativeComponent);
538  if(d->creationContext)
539  return d->creationContext->asQDeclarativeContext();
540 
541  return qmlContext(this);
542 }
543 
551 {
553 
554  d->clear();
555 
556  if ((url.isRelative() && !url.isEmpty())
557  || url.scheme() == QLatin1String("file")) // Workaround QTBUG-11929
558  d->url = d->engine->baseUrl().resolved(url);
559  else
560  d->url = url;
561 
562  if (url.isEmpty()) {
564  error.setDescription(tr("Invalid empty URL"));
565  d->state.errors << error;
566  return;
567  }
568 
570 
571  if (data->isCompleteOrError()) {
572  d->fromTypeData(data);
573  d->progress = 1.0;
574  } else {
575  d->typeData = data;
576  d->typeData->registerCallback(d);
577  d->progress = data->progress();
578  }
579 
581  emit progressChanged(d->progress);
582 }
583 
589 {
590  Q_D(const QDeclarativeComponent);
591  if (isError())
592  return d->state.errors;
593  else
594  return QList<QDeclarativeError>();
595 }
596 
616 {
617  Q_D(const QDeclarativeComponent);
618  QString ret;
619  if(!isError())
620  return ret;
621  foreach(const QDeclarativeError &e, d->state.errors) {
622  ret += e.url().toString() + QLatin1Char(':') +
623  QString::number(e.line()) + QLatin1Char(' ') +
624  e.description() + QLatin1Char('\n');
625  }
626  return ret;
627 }
628 
646 {
647  Q_D(const QDeclarativeComponent);
648  return d->url;
649 }
650 
655  : QObject(dd, parent)
656 {
657 }
658 
713 {
715  return d->createObject(parent, QScriptValue(QScriptValue::NullValue));
716 }
717 
723 {
725 
726  if (!valuemap.isObject() || valuemap.isArray()) {
727  qmlInfo(this) << tr("createObject: value is not an object");
729  }
730  return d->createObject(parent, valuemap);
731 }
732 
734 {
736  QDeclarativeContext* ctxt = q->creationContext();
737  if(!ctxt && engine)
738  ctxt = engine->rootContext();
739  if (!ctxt)
741  QObject* ret = q->beginCreate(ctxt);
742  if (!ret) {
743  q->completeCreate();
745  }
746 
747  if (publicParent) {
748  ret->setParent(publicParent);
750 
751  bool needParent = false;
752 
753  for (int ii = 0; ii < functions.count(); ++ii) {
754  QDeclarativePrivate::AutoParentResult res = functions.at(ii)(ret, publicParent);
755  if (res == QDeclarativePrivate::Parented) {
756  needParent = false;
757  break;
758  } else if (res == QDeclarativePrivate::IncompatibleParent) {
759  needParent = true;
760  }
761  }
762 
763  if (needParent)
764  qWarning("QDeclarativeComponent: Created graphical object was not placed in the graphics scene.");
765  }
766 
770 
771  if (valuemap.isObject() && !valuemap.isArray()) {
772  //Iterate through and assign properties
773  QScriptValueIterator it(valuemap);
774  while (it.hasNext()) {
775  it.next();
776  QScriptValue prop = newObject;
777  QString propName = it.name();
778  int index = propName.indexOf(QLatin1Char('.'));
779  if (index > 0) {
780  QString subProp = propName;
781  int lastIndex = 0;
782  while (index > 0) {
783  subProp = propName.mid(lastIndex, index - lastIndex);
784  prop = prop.property(subProp);
785  lastIndex = index + 1;
786  index = propName.indexOf(QLatin1Char('.'), index + 1);
787  }
788  prop.setProperty(propName.mid(propName.lastIndexOf(QLatin1Char('.')) + 1), it.value());
789  } else {
790  newObject.setProperty(propName, it.value());
791  }
792  }
793  }
794 
795  q->completeCreate();
796 
797  return newObject;
798 }
799 
809 {
811 
812  if (!context)
813  context = d->engine->rootContext();
814 
815  QObject *rv = beginCreate(context);
816  completeCreate();
817  return rv;
818 }
819 
844 {
846  QObject *rv = d->beginCreate(context?QDeclarativeContextData::get(context):0, QBitField());
847  if (rv) {
849  Q_ASSERT(ddata);
850  ddata->indestructible = true;
851  }
852  return rv;
853 }
854 
855 QObject *
857 {
859  if (!context) {
860  qWarning("QDeclarativeComponent: Cannot create a component in a null context");
861  return 0;
862  }
863 
864  if (!context->isValid()) {
865  qWarning("QDeclarativeComponent: Cannot create a component in an invalid context");
866  return 0;
867  }
868 
869  if (context->engine != engine) {
870  qWarning("QDeclarativeComponent: Must create component in context from the same QDeclarativeEngine");
871  return 0;
872  }
873 
874  if (state.completePending) {
875  qWarning("QDeclarativeComponent: Cannot create new component instance before completing the previous");
876  return 0;
877  }
878 
879  if (!q->isReady()) {
880  qWarning("QDeclarativeComponent: Component is not ready");
881  return 0;
882  }
883 
884  return begin(context, creationContext, cc, start, count, &state, 0, bindings);
885 }
886 
888  QDeclarativeContextData *componentCreationContext,
889  QDeclarativeCompiledData *component, int start, int count,
891  const QBitField &bindings)
892 {
894  bool isRoot = !enginePriv->inBeginCreate;
895 
896  Q_ASSERT(!isRoot || state); // Either this isn't a root component, or a state data must be provided
897  Q_ASSERT((state != 0) ^ (errors != 0)); // One of state or errors (but not both) must be provided
898 
899  if (isRoot) {
902  }
903 
905  ctxt->isInternal = true;
906  ctxt->url = component->url;
907  ctxt->imports = component->importCache;
908 
909  // Nested global imports
910  if (componentCreationContext && start != -1)
911  ctxt->importedScripts = componentCreationContext->importedScripts;
912 
913  component->importCache->addref();
914  ctxt->setParent(parentContext);
915 
916  enginePriv->inBeginCreate = true;
917 
918  QDeclarativeVME vme;
919  QObject *rv = vme.run(ctxt, component, start, count, bindings);
920 
921  if (vme.isError()) {
922  if(errors) *errors = vme.errors();
923  else state->errors = vme.errors();
924  }
925 
926  if (isRoot) {
927  enginePriv->inBeginCreate = false;
928 
929  state->bindValues = enginePriv->bindValues;
930  state->parserStatus = enginePriv->parserStatus;
931  state->finalizedParserStatus = enginePriv->finalizedParserStatus;
932  state->componentAttached = enginePriv->componentAttached;
933  if (state->componentAttached)
934  state->componentAttached->prev = &state->componentAttached;
935 
936  enginePriv->componentAttached = 0;
937  enginePriv->bindValues.clear();
938  enginePriv->parserStatus.clear();
939  enginePriv->finalizedParserStatus.clear();
940  state->completePending = true;
941  enginePriv->inProgressCreations++;
942  }
943 
944  if (enginePriv->isDebugging && rv) {
945  if (!parentContext->isInternal)
946  parentContext->asQDeclarativeContextPrivate()->instances.append(rv);
948  }
949 
950  return rv;
951 }
952 
954  QObject *object, ConstructionState *state)
955 {
956  bool isRoot = !enginePriv->inBeginCreate;
957  enginePriv->inBeginCreate = true;
958 
959  QDeclarativeVME vme;
960  vme.runDeferred(object);
961 
962  if (vme.isError())
963  state->errors = vme.errors();
964 
965  if (isRoot) {
966  enginePriv->inBeginCreate = false;
967 
968  state->bindValues = enginePriv->bindValues;
969  state->parserStatus = enginePriv->parserStatus;
970  state->finalizedParserStatus = enginePriv->finalizedParserStatus;
971  state->componentAttached = enginePriv->componentAttached;
972  if (state->componentAttached)
973  state->componentAttached->prev = &state->componentAttached;
974 
975  enginePriv->componentAttached = 0;
976  enginePriv->bindValues.clear();
977  enginePriv->parserStatus.clear();
978  enginePriv->finalizedParserStatus.clear();
979  state->completePending = true;
980  enginePriv->inProgressCreations++;
981  }
982 }
983 
985 {
986  if (state->completePending) {
987  QT_TRY {
988  for (int ii = 0; ii < state->bindValues.count(); ++ii) {
990  state->bindValues.at(ii);
991  for (int jj = 0; jj < bv.count; ++jj) {
992  if(bv.at(jj)) {
993  // XXX akennedy
994  bv.at(jj)->m_mePtr = 0;
997  }
998  }
1000  }
1001 
1002  for (int ii = 0; ii < state->parserStatus.count(); ++ii) {
1004  state->parserStatus.at(ii);
1005 
1006  for (int jj = ps.count - 1; jj >= 0; --jj) {
1008  if (status && status->d) {
1009  status->d = 0;
1010  status->componentComplete();
1011  }
1012  }
1014  }
1015 
1016  for (int ii = 0; ii < state->finalizedParserStatus.count(); ++ii) {
1018  QObject *obj = status.first;
1019  if (obj) {
1020  void *args[] = { 0 };
1022  status.second, args);
1023  }
1024  }
1025 
1026  //componentComplete() can register additional finalization objects
1027  //that are then never handled. Handle them manually here.
1028  if (1 == enginePriv->inProgressCreations) {
1029  for (int ii = 0; ii < enginePriv->finalizedParserStatus.count(); ++ii) {
1031  QObject *obj = status.first;
1032  if (obj) {
1033  void *args[] = { 0 };
1035  status.second, args);
1036  }
1037  }
1038  enginePriv->finalizedParserStatus.clear();
1039  }
1040 
1041  while (state->componentAttached) {
1043  a->rem();
1045  Q_ASSERT(d);
1046  Q_ASSERT(d->context);
1047  a->add(&d->context->componentAttached);
1048  emit a->completed();
1049  }
1050  } QT_CATCH(const std::exception&) {
1051  state->bindValues.clear();
1052  state->parserStatus.clear();
1053  state->finalizedParserStatus.clear();
1054  state->completePending = false;
1055  enginePriv->inProgressCreations--;
1056  QT_RETHROW;
1057  }
1058 
1059  state->bindValues.clear();
1060  state->parserStatus.clear();
1061  state->finalizedParserStatus.clear();
1062  state->completePending = false;
1063 
1064  enginePriv->inProgressCreations--;
1065  if (0 == enginePriv->inProgressCreations) {
1066  while (enginePriv->erroredBindings) {
1067  enginePriv->warning(enginePriv->erroredBindings->error);
1068  enginePriv->erroredBindings->removeError();
1069  }
1070  }
1071  }
1072 }
1073 
1082 {
1084  d->completeCreate();
1085 }
1086 
1088 {
1089  if (state.completePending) {
1091  complete(ep, &state);
1092 
1094  }
1095 }
1096 
1098 : QObject(parent), prev(0), next(0)
1099 {
1100 }
1101 
1103 {
1104  if (prev) *prev = next;
1105  if (next) next->prev = prev;
1106  prev = 0;
1107  next = 0;
1108 }
1109 
1114 {
1116 
1117  QDeclarativeEngine *engine = qmlEngine(obj);
1118  if (!engine)
1119  return a;
1120 
1121  if (QDeclarativeEnginePrivate::get(engine)->inBeginCreate) {
1123  a->add(&p->componentAttached);
1124  } else {
1126  Q_ASSERT(d);
1127  Q_ASSERT(d->context);
1128  a->add(&d->context->componentAttached);
1129  }
1130 
1131  return a;
1132 }
1133 
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
double d
Definition: qnumeric_p.h:62
Q_INVOKABLE QScriptValue createObject(QObject *parent)
A version of create which returns a scriptObject, for use in script.
QDeclarativeContextData * context
QDeclarativeComponentAttached * next
bool isError() const
Returns true if the status is Error.
Status
Emitted after component "startup" has completed.
static QDeclarativeData * get(const QObject *object, bool create=false)
QScriptValue property(const QString &name, const ResolveFlags &mode=ResolvePrototype) const
Returns the value of this QScriptValue&#39;s property with the given name, using the given mode to resolv...
QUrl url() const
Returns the url for the file that caused this error.
double qreal
Definition: qglobal.h:1193
unsigned char c[8]
Definition: qnumeric_p.h:62
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
QDeclarativeParserStatus ** d
void setDescription(const QString &)
Sets the error description.
QUrl finalUrl() const
Returns the final url of the data.
QString toString(FormattingOptions options=None) const
Returns the human-displayable string representation of the URL.
Definition: qurl.cpp:5896
QDeclarativeEngine * engine
#define it(className, varName)
QList< QPair< QDeclarativeGuard< QObject >, int > > finalizedParserStatus
static int metacall(QObject *, Call, int, void **)
#define error(msg)
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:135
QDeclarativeComponentAttached(QObject *parent=0)
bool isEmpty() const
Returns true if the URL has no data; otherwise returns false.
Definition: qurl.cpp:4317
QDeclarativeComponentAttached * componentAttached
QDeclarativeCompiledData * compiledData() const
bool isError() const
T1 first
Definition: qpair.h:65
T2 second
Definition: qpair.h:66
void runDeferred(QObject *)
virtual void typeDataReady(QDeclarativeTypeData *)
QString name() const
Returns the name of the last property that was jumped over using next() or previous().
bool isReady() const
Returns true if status() == QDeclarativeComponent::Ready.
void setData(const QByteArray &, const QUrl &baseUrl)
Sets the QDeclarativeComponent to use the given QML data.
QDeclarativeComponentAttached ** prev
static QString tr(const char *sourceText, const char *comment=0, int n=-1)
bool isCompleteOrError() const
Returns true if the status is Complete or Error.
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
QList< QDeclarativeError > errors() const
void add(QDeclarativeComponentAttached **a)
long ASN1_INTEGER_get ASN1_INTEGER * a
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
int count() const
Same as size().
Definition: qbytearray.h:355
QObject * beginCreate(QDeclarativeContextData *, const QBitField &)
QScriptValue createObject(QObject *publicParent, const QScriptValue valuemap)
The QUrl class provides a convenient interface for working with URLs.
Definition: qurl.h:61
QDeclarativeTypeLoader typeLoader
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
Q_DECLARATIVE_EXPORT QDeclarativeContext * qmlContext(const QObject *)
#define Q_D(Class)
Definition: qglobal.h:2482
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
virtual QObject * create(QDeclarativeContext *context=0)
Create an object instance from this component.
bool isRelative() const
Returns true if the URL is relative; otherwise returns false.
Definition: qurl.cpp:5880
void loadUrl(const QUrl &url)
Load the QDeclarativeComponent from the provided url.
QList< QPair< QDeclarativeGuard< QObject >, int > > finalizedParserStatus
QDeclarativeTypeNameCache * imports
QDeclarativeComponent(QObject *parent=0)
void setParent(QObject *)
Makes the object a child of parent.
Definition: qobject.cpp:1950
qreal progress() const
Returns the data download progress from 0 to 1.
QScriptValue newQObject(QObject *, int type=QMetaType::QObjectStar)
#define Q_Q(Class)
Definition: qglobal.h:2483
virtual void componentComplete()=0
Invoked after the root component that caused this instantiation has completed construction.
#define QT_RETHROW
Definition: qglobal.h:1539
QList< QDeclarativeEnginePrivate::SimpleList< QDeclarativeParserStatus > > parserStatus
void append(const T &t)
Inserts value at the end of the list.
Definition: qlist.h:507
void setParent(QDeclarativeContextData *)
QDeclarativeContextPrivate * asQDeclarativeContextPrivate()
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
The QDeclarativeComponent class encapsulates a QML component definition.
QList< QDeclarativeError > errors() const
Return the list of errors that occurred during the last compile or create operation.
The QDeclarativeParserStatus class provides updates on the QML parser state.
QDeclarativeCompiledData * cc
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468
#define emit
Definition: qobjectdefs.h:76
QString description() const
Returns the error description.
Q_CORE_EXPORT void qWarning(const char *,...)
static const char * data(const QByteArray &arr)
int indexOf(QChar c, int from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:2838
void unregisterCallback(TypeDataCallback *)
virtual QObject * beginCreate(QDeclarativeContext *)
This method provides more advanced control over component instance creation.
The QDeclarativeError class encapsulates a QML error.
static QList< QDeclarativePrivate::AutoParentFunction > parentFunctions()
void fromTypeData(QDeclarativeTypeData *data)
QObject * run(QDeclarativeContextData *, QDeclarativeCompiledData *, int start=-1, int count=-1, const QBitField &=QBitField())
void clear()
Removes all items from the list.
Definition: qlist.h:764
static qreal component(const QPointF &point, unsigned int i)
static void complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state)
static void beginDeferred(QDeclarativeEnginePrivate *enginePriv, QObject *object, ConstructionState *state)
#define QT_CATCH(A)
Definition: qglobal.h:1537
QList< SimpleList< QDeclarativeAbstractBinding > > bindValues
int line() const
Returns the error line number.
bool isLoading() const
Returns true if status() == QDeclarativeComponent::Loading.
QDeclarativeObjectScriptClass * objectClass
QList< QPointer< QObject > > instances
static void endRange(RangeType)
static void startRange(RangeType)
qreal progress() const
Status status() const
QString mid(int position, int n=-1) const Q_REQUIRED_RESULT
Returns a string that contains n characters of this string, starting at the specified position index...
Definition: qstring.cpp:3706
QString scheme() const
Returns the scheme of the URL.
Definition: qurl.cpp:4550
static QDeclarativeComponentAttached * qmlAttachedProperties(QObject *)
void setProperty(const QString &name, const QScriptValue &value, const PropertyFlags &flags=KeepExistingFlags)
Sets the value of this QScriptValue&#39;s property with the given name to the given value.
static QObject * begin(QDeclarativeContextData *parentContext, QDeclarativeContextData *componentCreationContext, QDeclarativeCompiledData *component, int start, int count, ConstructionState *state, QList< QDeclarativeError > *errors, const QBitField &bindings=QBitField())
The QScriptValueIterator class provides a Java-style iterator for QScriptValue.
Q_DECLARATIVE_EXPORT QDeclarativeEngine * qmlEngine(const QObject *)
QList< QDeclarativeError > errors() const
Return the errors on this blob.
The QDeclarativeEngine class provides an environment for instantiating QML components.
static void clear(SimpleList< QDeclarativeAbstractBinding > &)
iterator begin()
Definition: qbytearray.h:493
int lastIndexOf(QChar c, int from=-1, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Definition: qstring.cpp:3000
static QDeclarativeEngineDebugService * instance()
QDeclarativeDelayedError * erroredBindings
QObject * parent() const
Returns a pointer to the parent object.
Definition: qobject.h:273
QScriptValue value() const
Returns the value of the last property that was jumped over using next() or previous().
static const QMetaObjectPrivate * priv(const uint *data)
QDeclarativeComponentAttached * componentAttached
static void rangeData(RangeType, const QString &)
The QDeclarativeContext class defines a context within a QML engine.
void objectCreated(QDeclarativeEngine *, QObject *)
quint16 index
QObject * parent
Definition: qobject.h:92
QDeclarativeTypeData * get(const QUrl &url)
Returns a QDeclarativeTypeData for the specified url.
QList< QDeclarativeEnginePrivate::SimpleList< QDeclarativeAbstractBinding > > bindValues
static QUrl fromLocalFile(const QString &localfile)
Returns a QUrl representation of localFile, interpreted as a local file.
Definition: qurl.cpp:6374
virtual ~QDeclarativeComponent()
Destruct the QDeclarativeComponent.
QDeclarativeTypeNameCache * importCache
bool isArray() const
Returns true if this QScriptValue is an object of the Array class; otherwise returns false...
QDeclarativeInfo qmlInfo(const QObject *me)
Q_INVOKABLE QString errorString() const
virtual void typeDataProgress(QDeclarativeTypeData *, qreal)
bool isError() const
Returns true if status() == QDeclarativeComponent::Error.
void warning(const QDeclarativeError &)
QList< QScriptValue > importedScripts
The QScriptValue class acts as a container for the Qt Script data types.
Definition: qscriptvalue.h:57
static QString fileName(const QString &fileUrl)
#define QT_TRY
Definition: qglobal.h:1536
bool isNull() const
Returns true if status() == QDeclarativeComponent::Null.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55
void statusChanged(QDeclarativeComponent::Status)
Emitted whenever the component&#39;s status changes.
void next()
Advances the iterator by one position.
virtual void completeCreate()
This method provides more advanced control over component instance creation.
QList< SimpleList< QDeclarativeParserStatus > > parserStatus
bool isObject() const
Returns true if this QScriptValue is of the Object type; otherwise returns false. ...
bool hasNext() const
Returns true if there is at least one item ahead of the iterator (i.e.
QDeclarativeContext * creationContext() const
Returns the QDeclarativeContext the component was created in.
void progressChanged(qreal)
Emitted whenever the component&#39;s loading progress changes.
QDeclarativeAbstractBinding ** m_mePtr
static QDeclarativeContextData * get(QDeclarativeContext *context)