Qt 4.8
Classes | Macros | Functions | Variables
qdeclarativeengine.cpp File Reference
#include "private/qdeclarativeengine_p.h"
#include "qdeclarativeengine.h"
#include "private/qdeclarativeboundsignal_p.h"
#include "private/qdeclarativecontext_p.h"
#include "private/qdeclarativecompiler_p.h"
#include "private/qdeclarativeglobalscriptclass_p.h"
#include "qdeclarative.h"
#include "qdeclarativecontext.h"
#include "qdeclarativeexpression.h"
#include "qdeclarativecomponent.h"
#include "private/qdeclarativebinding_p_p.h"
#include "private/qdeclarativevme_p.h"
#include "private/qdeclarativeenginedebugservice_p.h"
#include "private/qdeclarativestringconverters_p.h"
#include "private/qdeclarativexmlhttprequest_p.h"
#include "private/qdeclarativesqldatabase_p.h"
#include "private/qdeclarativetypenamescriptclass_p.h"
#include "private/qdeclarativelistscriptclass_p.h"
#include "qdeclarativescriptstring.h"
#include "private/qdeclarativeglobal_p.h"
#include "private/qdeclarativeworkerscript_p.h"
#include "private/qdeclarativecomponent_p.h"
#include "qdeclarativenetworkaccessmanagerfactory.h"
#include "qdeclarativeimageprovider.h"
#include "private/qdeclarativedirparser_p.h"
#include "qdeclarativeextensioninterface.h"
#include "private/qdeclarativelist_p.h"
#include "private/qdeclarativetypenamecache_p.h"
#include "private/qdeclarativeinclude_p.h"
#include "private/qdeclarativenotifier_p.h"
#include "private/qdeclarativedebugtrace_p.h"
#include "private/qdeclarativeapplication_p.h"
#include "private/qjsdebugservice_p.h"
#include <QtCore/qmetaobject.h>
#include <QScriptClass>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QNetworkAccessManager>
#include <QDesktopServices>
#include <QTimer>
#include <QList>
#include <QPair>
#include <QDebug>
#include <QMetaObject>
#include <QStack>
#include <QMap>
#include <QPluginLoader>
#include <QtGui/qapplication.h>
#include <QtGui/qfontdatabase.h>
#include <QtCore/qlibraryinfo.h>
#include <QtCore/qthreadstorage.h>
#include <QtCore/qthread.h>
#include <QtCore/qcoreapplication.h>
#include <QtCore/qdir.h>
#include <QtCore/qmutex.h>
#include <QtGui/qcolor.h>
#include <QtGui/qvector3d.h>
#include <QtGui/qsound.h>
#include <QtCore/qcryptographichash.h>
#include <private/qobject_p.h>
#include <private/qscriptdeclarativeclass_p.h>
#include <private/qdeclarativeitemsmodule_p.h>
#include <private/qdeclarativeutilmodule_p.h>
#include <qt_windows.h>
#include <qlibrary.h>
#include <windows.h>

Go to the source code of this file.

Classes

class  QDeclarativeDataExtended
 
struct  StaticQtMetaObject
 

Macros

#define CSIDL_APPDATA   0x001a
 

Functions

static void dumpwarning (const QDeclarativeError &error)
 
static void dumpwarning (const QList< QDeclarativeError > &errors)
 
bool QDeclarative_isFileCaseCorrect (const QString &fileName)
 Returns true if the case of fileName is equivalent to the file case of fileName on disk, and false otherwise. More...
 
QObjectqmlAttachedPropertiesObject (int *idCache, const QObject *object, const QMetaObject *attachedMetaObject, bool create)
 
QObjectqmlAttachedPropertiesObjectById (int id, const QObject *object, bool create)
 
QDeclarativeContextqmlContext (const QObject *obj)
 
QDeclarativeEngineqmlEngine (const QObject *obj)
 
Q_AUTOTEST_EXPORT void qmlExecuteDeferred (QObject *object)
 
static void * voidptr_constructor (const void *v)
 
static void voidptr_destructor (void *v)
 

Variables

static bool qt_QmlQtModule_registered = false
 

Macro Definition Documentation

◆ CSIDL_APPDATA

#define CSIDL_APPDATA   0x001a

Definition at line 115 of file qdeclarativeengine.cpp.

Function Documentation

◆ dumpwarning() [1/2]

static void dumpwarning ( const QDeclarativeError error)
static

Definition at line 1980 of file qdeclarativeengine.cpp.

Referenced by dumpwarning(), and QDeclarativeEnginePrivate::warning().

1981 {
1982  qWarning().nospace() << qPrintable(error.toString());
1983 }
QString toString() const
Returns the error as a human readable string.
Q_CORE_EXPORT void qWarning(const char *,...)
#define qPrintable(string)
Definition: qglobal.h:1750

◆ dumpwarning() [2/2]

static void dumpwarning ( const QList< QDeclarativeError > &  errors)
static

Definition at line 1985 of file qdeclarativeengine.cpp.

1986 {
1987  for (int ii = 0; ii < errors.count(); ++ii)
1988  dumpwarning(errors.at(ii));
1989 }
int count(const T &t) const
Returns the number of occurrences of value in the list.
Definition: qlist.h:891
static void dumpwarning(const QDeclarativeError &error)
const T & at(int i) const
Returns the item at index position i in the list.
Definition: qlist.h:468

◆ QDeclarative_isFileCaseCorrect()

bool QDeclarative_isFileCaseCorrect ( const QString fileName)

Returns true if the case of fileName is equivalent to the file case of fileName on disk, and false otherwise.

This is used to ensure that the behavior of QML on a case-insensitive file system is the same as on a case-sensitive file system. This function performs a "best effort" attempt to determine the real case of the file. It may have false positives (say the case is correct when it isn't), but it should never have a false negative (say the case is incorrect when it is correct).

Definition at line 2550 of file qdeclarativeengine.cpp.

Referenced by QDeclarativeImportDatabase::importPlugin(), QDeclarativeDataLoader::load(), QDeclarativeDirParser::parse(), and QDeclarativeGraphics_DerivedObject::setParent_noEvent().

2551 {
2552 #if defined(Q_OS_MAC) || defined(Q_OS_WIN32)
2553  QFileInfo info(fileName);
2554 
2555  QString absolute = info.absoluteFilePath();
2556 
2557 #if defined(Q_OS_MAC)
2558  QString canonical = info.canonicalFilePath();
2559 #elif defined(Q_OS_WIN32)
2560  wchar_t buffer[1024];
2561 
2562  DWORD rv = ::GetShortPathName((wchar_t*)absolute.utf16(), buffer, 1024);
2563  if (rv == 0 || rv >= 1024) return true;
2564  rv = ::GetLongPathName(buffer, buffer, 1024);
2565  if (rv == 0 || rv >= 1024) return true;
2566 
2567  QString canonical((QChar *)buffer);
2568 #endif
2569 
2570  int absoluteLength = absolute.length();
2571  int canonicalLength = canonical.length();
2572 
2573  int length = qMin(absoluteLength, canonicalLength);
2574  for (int ii = 0; ii < length; ++ii) {
2575  const QChar &a = absolute.at(absoluteLength - 1 - ii);
2576  const QChar &c = canonical.at(canonicalLength - 1 - ii);
2577 
2578  if (a.toLower() != c.toLower())
2579  return true;
2580  if (a != c)
2581  return false;
2582  }
2583 #else
2584  Q_UNUSED(fileName)
2585 #endif
2586  return true;
2587 }
static mach_timebase_info_data_t info
unsigned char c[8]
Definition: qnumeric_p.h:62
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
const QChar at(int i) const
Returns the character at the given index position in the string.
Definition: qstring.h:698
int length() const
Returns the number of characters in this string.
Definition: qstring.h:696
long ASN1_INTEGER_get ASN1_INTEGER * a
The QString class provides a Unicode character string.
Definition: qstring.h:83
The QChar class provides a 16-bit Unicode character.
Definition: qchar.h:72
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:60
#define Q_UNUSED(x)
Indicates to the compiler that the parameter with the specified name is not used in the body of a fun...
Definition: qglobal.h:1729
QChar toLower() const
Returns the lowercase equivalent if the character is uppercase or titlecase; otherwise returns the ch...
Definition: qchar.cpp:1239
const ushort * utf16() const
Returns the QString as a &#39;\0\&#39;-terminated array of unsigned shorts.
Definition: qstring.cpp:5290

◆ qmlAttachedPropertiesObject()

QObject* qmlAttachedPropertiesObject ( int *  idCache,
const QObject object,
const QMetaObject attachedMetaObject,
bool  create 
)

Definition at line 1106 of file qdeclarativeengine.cpp.

Referenced by qmlAttachedPropertiesObject(), and qmlRegisterCustomType().

1108 {
1109  if (*idCache == -1)
1110  *idCache = QDeclarativeMetaType::attachedPropertiesFuncId(attachedMetaObject);
1111 
1112  if (*idCache == -1 || !object)
1113  return 0;
1114 
1115  return qmlAttachedPropertiesObjectById(*idCache, object, create);
1116 }
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
static int attachedPropertiesFuncId(const QMetaObject *)
QObject * qmlAttachedPropertiesObjectById(int id, const QObject *object, bool create)

◆ qmlAttachedPropertiesObjectById()

QObject* qmlAttachedPropertiesObjectById ( int  id,
const QObject object,
bool  create 
)

Definition at line 1084 of file qdeclarativeengine.cpp.

Referenced by QDeclarativePropertyPrivate::initProperty(), qmlAttachedPropertiesObject(), qmlRegisterCustomType(), QDeclarativeTypeNameScriptClass::queryProperty(), and QDeclarativeCompiledBindingsPrivate::run().

1085 {
1087  if (!data)
1088  return 0; // Attached properties are only on objects created by QML
1089 
1090  QObject *rv = data->hasExtendedData()?data->attachedProperties()->value(id):0;
1091  if (rv || !create)
1092  return rv;
1093 
1095  if (!pf)
1096  return 0;
1097 
1098  rv = pf(const_cast<QObject *>(object));
1099 
1100  if (rv)
1101  data->attachedProperties()->insert(id, rv);
1102 
1103  return rv;
1104 }
QObject *(* QDeclarativeAttachedPropertiesFunc)(QObject *)
static QDeclarativeData * get(const QObject *object, bool create=false)
static QDeclarativeAttachedPropertiesFunc attachedPropertiesFuncById(int)
static Expression::Ptr create(Expression *const expr, const YYLTYPE &sourceLocator, const ParserContext *const parseInfo)
QHash< int, QObject * > * attachedProperties() const
The QObject class is the base class of all Qt objects.
Definition: qobject.h:111
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
static const char * data(const QByteArray &arr)
bool hasExtendedData() const

◆ qmlContext()

QDeclarativeContext* qmlContext ( const QObject obj)

Definition at line 1073 of file qdeclarativeengine.cpp.

Referenced by QDeclarativeLoaderPrivate::_q_sourceLoaded(), QDeclarativePropertyChanges::actions(), QDeclarativeParentChange::actions(), QDeclarativeAnchorChanges::actions(), QDeclarativeAnchorChanges::additionalActions(), QDeclarativeWatcher::addWatch(), QDeclarativePropertyChanges::changeExpression(), QDeclarativeGestureArea::connectSignals(), QDeclarativeConnections::connectSignals(), QDeclarativeGridViewPrivate::createComponentItem(), QDeclarativeListViewPrivate::createComponentItem(), QDeclarativePathViewPrivate::createHighlight(), QDeclarativeAbstractAnimationPrivate::createProperty(), QDeclarativeListViewPrivate::createSection(), QDeclarativeComponent::creationContext(), QDeclarativePropertyChangesPrivate::decode(), QDeclarativeXmlListModel::get(), QDeclarativeVisualDataModel::item(), QDeclarativeTextEdit::loadCursorDelegate(), QTextDocumentWithImageResources::loadResource(), QDeclarativeEngineDebugService::messageReceived(), QDeclarativeEngineDebugService::objectData(), QDeclarativePropertyChangesPrivate::property(), qmlRegisterCustomType(), QDeclarativeXmlListModel::reload(), QDeclarativeEngineDebugService::resetBinding(), QDeclarativeEngineDebugService::setBinding(), QDeclarativeRepeater::setDelegate(), QDeclarativeGridView::setDelegate(), QDeclarativePathView::setDelegate(), QDeclarativeListView::setDelegate(), QDeclarativeEngineDebugService::setMethodBody(), QDeclarativeRepeater::setModel(), QDeclarativePathView::setModel(), QDeclarativeGridView::setModel(), QDeclarativeListView::setModel(), and QDeclarativeFontLoader::setSource().

1074 {
1076 }
static QDeclarativeContext * contextForObject(const QObject *)
Returns the QDeclarativeContext for the object, or 0 if no context has been set.

◆ qmlEngine()

QDeclarativeEngine* qmlEngine ( const QObject obj)

Definition at line 1078 of file qdeclarativeengine.cpp.

Referenced by QDeclarativeLoaderPrivate::_q_sourceLoaded(), QDeclarativeXmlListModel::classBegin(), QDeclarativePathView::createdItem(), QDeclarativeWorkerScript::engine(), QDeclarativeWorkerScript::event(), FlatListModel::get(), NestedListModel::get(), QDeclarativePathViewPrivate::getItem(), QDeclarativeBorderImage::load(), QDeclarativeImageBase::load(), QDeclarativeAnimatedImage::load(), QDeclarativeItem::mapFromItem(), QDeclarativeItem::mapToItem(), ModelNode::object(), QDeclarativeComponent::qmlAttachedProperties(), qmlRegisterCustomType(), QDeclarativeXmlListModel::reload(), QDeclarativeXmlListModel::requestFinished(), QDeclarativeBorderImage::setGridScaledImage(), QDeclarativeVisualDataModel::setModel(), QDeclarativeAbstractAnimation::setRunning(), QDeclarativeLoader::setSource(), QDeclarativeFontLoader::setSource(), QDeclarativeParticles::setSource(), QDeclarativeBehavior::setTarget(), and QDeclarativeInfo::~QDeclarativeInfo().

1079 {
1081  return context?context->engine():0;
1082 }
The QDeclarativeContext class defines a context within a QML engine.
QDeclarativeEngine * engine() const
Return the context&#39;s QDeclarativeEngine, or 0 if the context has no QDeclarativeEngine or the QDeclar...
static QDeclarativeContext * contextForObject(const QObject *)
Returns the QDeclarativeContext for the object, or 0 if no context has been set.

◆ qmlExecuteDeferred()

Q_AUTOTEST_EXPORT void qmlExecuteDeferred ( QObject object)

Definition at line 1047 of file qdeclarativeengine.cpp.

Referenced by QDeclarativeState::apply(), QDeclarativeStatePrivate::generateActionList(), QDeclarativeTransition::prepare(), QDeclarativeEngineDebugService::prepareDeferredObjects(), qmlRegisterCustomType(), and QDeclarativeBehavior::write().

1048 {
1050 
1051  if (data && data->deferredComponent) {
1057  if (data->outerContext)
1059  }
1061 
1063  QDeclarativeComponentPrivate::beginDeferred(ep, object, &state);
1064 
1065  data->deferredComponent->release();
1066  data->deferredComponent = 0;
1067 
1070  }
1071 }
QDeclarativeContextData * outerContext
QDeclarativeContextData * context
static QDeclarativeData * get(const QObject *object, bool create=false)
int type
Definition: qmetatype.cpp:239
QDeclarativeEngine * engine
static void rangeLocation(RangeType, const QString &, int)
static QDeclarativeType * qmlType(const QByteArray &, int, int)
Returns the type (if any) of URI-qualified named name in version specified by version_major and versi...
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
static QDeclarativeEnginePrivate * get(QDeclarativeEngine *e)
QDeclarativeCompiledData * deferredComponent
const char * typeName
Definition: qmetatype.cpp:239
static const char * data(const QByteArray &arr)
QByteArray qmlTypeName() const
static void complete(QDeclarativeEnginePrivate *enginePriv, ConstructionState *state)
static void beginDeferred(QDeclarativeEnginePrivate *enginePriv, QObject *object, ConstructionState *state)
static void endRange(RangeType)
static void startRange(RangeType)
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
Definition: qstring.cpp:4188
const char * className() const
Returns the class name.
Definition: qobjectdefs.h:491
static void rangeData(RangeType, const QString &)
virtual const QMetaObject * metaObject() const
Returns a pointer to the meta-object of this object.

◆ voidptr_constructor()

static void* voidptr_constructor ( const void *  v)
static

Definition at line 2343 of file qdeclarativeengine.cpp.

Referenced by QDeclarativeEnginePrivate::registerCompositeType().

2344 {
2345  if (!v) {
2346  return new void*;
2347  } else {
2348  return new void*(*(void **)v);
2349  }
2350 }

◆ voidptr_destructor()

static void voidptr_destructor ( void *  v)
static

Definition at line 2337 of file qdeclarativeengine.cpp.

Referenced by QDeclarativeEnginePrivate::registerCompositeType().

2338 {
2339  void **ptr = (void **)v;
2340  delete ptr;
2341 }
const T * ptr(const T &t)

Variable Documentation

◆ qt_QmlQtModule_registered

bool qt_QmlQtModule_registered = false
static