Source

Target

Showing with 153 additions and 75 deletions
...@@ -68,7 +68,7 @@ ...@@ -68,7 +68,7 @@
as a new QML type. It provides the current time through \c hour and \c minute as a new QML type. It provides the current time through \c hour and \c minute
properties. properties.
\snippet qml/plugins/plugin.cpp 0 \snippet plugins/plugin.cpp 0
\dots \dots
To make this type available, we create a plugin class named \c QExampleQmlPlugin To make this type available, we create a plugin class named \c QExampleQmlPlugin
...@@ -78,7 +78,7 @@ ...@@ -78,7 +78,7 @@
definition to register the plugin with the Qt meta object system using a unique definition to register the plugin with the Qt meta object system using a unique
identifier for the plugin. identifier for the plugin.
\snippet qml/plugins/plugin.cpp plugin \snippet plugins/plugin.cpp plugin
The \c TimeModel class receives a \c{1.0} version of this plugin library, as The \c TimeModel class receives a \c{1.0} version of this plugin library, as
a QML type called \c Time. The Q_ASSERT() macro can ensure the type namespace is a QML type called \c Time. The Q_ASSERT() macro can ensure the type namespace is
...@@ -111,13 +111,13 @@ ...@@ -111,13 +111,13 @@
that is built by the project (as shown above in the \c .pro file) so both of these that is built by the project (as shown above in the \c .pro file) so both of these
need to be specified in the \c qmldir file: need to be specified in the \c qmldir file:
\quotefile qml/plugins/imports/TimeExample/qmldir \quotefile plugins/imports/TimeExample/qmldir
Once the project is built and installed, the new \c Time component is Once the project is built and installed, the new \c Time component is
accessible by any QML component that imports the \c TimeExample accessible by any QML component that imports the \c TimeExample
module module
\snippet qml/plugins/plugins.qml 0 \snippet plugins/plugins.qml 0
The full source code is available in the \l {qml/plugins}{plugins example}. The full source code is available in the \l {qml/plugins}{plugins example}.
......
...@@ -368,7 +368,7 @@ Module { ...@@ -368,7 +368,7 @@ Module {
// The name of the type containing attached properties // The name of the type containing attached properties
// and methods. // and methods.
attachedType: "QDeclarativeAnimationAttached" attachedType: "QQuickAnimationAttached"
// The list of exports determines how a type can be imported. // The list of exports determines how a type can be imported.
// Each string has the format "URI/Name version" and matches the // Each string has the format "URI/Name version" and matches the
......
...@@ -27,7 +27,6 @@ ...@@ -27,7 +27,6 @@
/*! /*!
\page qtqml-syntax-signals.html \page qtqml-syntax-signals.html
\ingroup qml-features
\title Signal and Handler Event System \title Signal and Handler Event System
\brief the event sytem in QML \brief the event sytem in QML
...@@ -294,4 +293,3 @@ output: ...@@ -294,4 +293,3 @@ output:
*/ */
...@@ -93,7 +93,7 @@ MyDatePicker { minDate: "2000-01-01"; maxDate: "2020-12-31" } ...@@ -93,7 +93,7 @@ MyDatePicker { minDate: "2000-01-01"; maxDate: "2020-12-31" }
\endqml \endqml
To read a date value returned from a C++ extension class, use To read a date value returned from a C++ extension class, use
\l{QML:Qt::formatDate()}{Qt.formatDate()} and \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}. \l{QtQml2::Qt::formatDate()}{Qt.formatDate()} and \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}.
When integrating with C++, note that any QDate value When integrating with C++, note that any QDate value
\l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically \l{qtqml-cppintegration-data.html}{passed into QML from C++} is automatically
...@@ -124,7 +124,7 @@ MyTimePicker { time: "14:22:15" } ...@@ -124,7 +124,7 @@ MyTimePicker { time: "14:22:15" }
\endqml \endqml
To read a time value returned from a C++ extension class, use To read a time value returned from a C++ extension class, use
\l{QML:Qt::formatTime()}{Qt.formatTime()} and \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}. \l{QtQml2::Qt::formatTime()}{Qt.formatTime()} and \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}.
Note that when converting historical times to and from javascript that QDateTime and the JS Date object Note that when converting historical times to and from javascript that QDateTime and the JS Date object
have different methods of calculating historical daylight savings time application. This can lead to variations of one hour have different methods of calculating historical daylight savings time application. This can lead to variations of one hour
...@@ -153,7 +153,7 @@ To create a \c point value, specify it as a "x,y" string: ...@@ -153,7 +153,7 @@ To create a \c point value, specify it as a "x,y" string:
CustomObject { myPointProperty: "0,20" } CustomObject { myPointProperty: "0,20" }
\endqml \endqml
Or use the \l{QML:Qt::point()}{Qt.point()} function: Or use the \l{QtQml2::Qt::point()}{Qt.point()} function:
\qml \qml
CustomObject { myPointProperty: Qt.point(0, 20) } CustomObject { myPointProperty: Qt.point(0, 20) }
...@@ -191,7 +191,7 @@ To create a \c size value, specify it as a "width x height" string: ...@@ -191,7 +191,7 @@ To create a \c size value, specify it as a "width x height" string:
Image { sourceSize: "150x50" } Image { sourceSize: "150x50" }
\endqml \endqml
Or use the \l{QML:Qt::size()}{Qt.size()} function: Or use the \l{QtQml2::Qt::size()}{Qt.size()} function:
\qml \qml
Image { sourceSize: Qt.size(150, 50) } Image { sourceSize: Qt.size(150, 50) }
...@@ -231,7 +231,7 @@ To create a \c rect value, specify it as a "x, y, width x height" string: ...@@ -231,7 +231,7 @@ To create a \c rect value, specify it as a "x, y, width x height" string:
CustomObject { myRectProperty: "50,50,100x100" } CustomObject { myRectProperty: "50,50,100x100" }
\endqml \endqml
Or use the \l{QML:Qt::rect()}{Qt.rect()} function: Or use the \l{QtQml2::Qt::rect()}{Qt.rect()} function:
\qml \qml
CustomObject { myRectProperty: Qt.rect(50, 50, 100, 100) } CustomObject { myRectProperty: Qt.rect(50, 50, 100, 100) }
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
\brief The Qt QML module defines and implements the QML language \brief The Qt QML module defines and implements the QML language
The Qt QML module provides a framework for developing applications and libraries The Qt QML module provides a framework for developing applications and libraries
with the \l{The QML Language}{QML language}. It defines and implements the with the \l{QML Application Developer Resources}{QML language}. It defines and implements the
language and engine infrastructure, and provides an API to enable application language and engine infrastructure, and provides an API to enable application
developers to extend the QML language with custom types and integrate QML code developers to extend the QML language with custom types and integrate QML code
with JavaScript and C++. The Qt QML module provides both a \l{Qt QML QML Types} with JavaScript and C++. The Qt QML module provides both a \l{Qt QML QML Types}
......
...@@ -94,7 +94,7 @@ has now been replaced by the new \l {Qt QML} and \l {Qt Quick} modules. See the ...@@ -94,7 +94,7 @@ has now been replaced by the new \l {Qt QML} and \l {Qt Quick} modules. See the
\list \list
\li QQmlExpression can now be constructed directly (and more efficiently) from a QQmlScriptString. \li QQmlExpression can now be constructed directly (and more efficiently) from a QQmlScriptString.
\li The \l {QML:Qt} object now provides a \l{QML:Qt::inputMethod} property to access the active \li The \l {QtQml2::Qt}{Qt} global object now provides an \l{QtQml2::Qt::inputMethod}{inputMethod} property to access the active
text input method for an application. text input method for an application.
\endlist \endlist
......
...@@ -419,11 +419,17 @@ class QQmlContext; ...@@ -419,11 +419,17 @@ class QQmlContext;
class QQmlEngine; class QQmlEngine;
class QJSValue; class QJSValue;
class QJSEngine; class QJSEngine;
Q_QML_EXPORT void qmlExecuteDeferred(QObject *);
Q_QML_EXPORT QQmlContext *qmlContext(const QObject *); namespace QtQml {
Q_QML_EXPORT QQmlEngine *qmlEngine(const QObject *); // declared in namespace to avoid symbol conflicts with QtDeclarative
Q_QML_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true); Q_QML_EXPORT void qmlExecuteDeferred(QObject *);
Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(int *, const QObject *, const QMetaObject *, bool create); Q_QML_EXPORT QQmlContext *qmlContext(const QObject *);
Q_QML_EXPORT QQmlEngine *qmlEngine(const QObject *);
Q_QML_EXPORT QObject *qmlAttachedPropertiesObjectById(int, const QObject *, bool create = true);
Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(int *, const QObject *,
const QMetaObject *, bool create);
}
using namespace QtQml;
template<typename T> template<typename T>
QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true) QObject *qmlAttachedPropertiesObject(const QObject *obj, bool create = true)
......
...@@ -133,7 +133,8 @@ void QQmlApplicationEnginePrivate::_q_finishLoad(QObject *o) ...@@ -133,7 +133,8 @@ void QQmlApplicationEnginePrivate::_q_finishLoad(QObject *o)
case QQmlComponent::Null: case QQmlComponent::Null:
return; //These cases just wait for the next status update return; //These cases just wait for the next status update
} }
delete c;
c->deleteLater();
} }
/*! /*!
......
...@@ -229,7 +229,7 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject) ...@@ -229,7 +229,7 @@ static inline QString buildTypeNameForDebug(const QMetaObject *metaObject)
to specify how each list item is to be displayed. to specify how each list item is to be displayed.
\c Component objects can also be created dynamically using \c Component objects can also be created dynamically using
\l{QML:Qt::createComponent()}{Qt.createComponent()}. \l{QtQml2::Qt::createComponent()}{Qt.createComponent()}.
\section2 Creation Context \section2 Creation Context
...@@ -1226,9 +1226,8 @@ void QQmlComponent::createObject(QQmlV8Function *args) ...@@ -1226,9 +1226,8 @@ void QQmlComponent::createObject(QQmlV8Function *args)
instances to be instantiated asynchronously and not cause freezes in the UI. instances to be instantiated asynchronously and not cause freezes in the UI.
The \a parent argument specifies the parent the created instance will have. Omitting the The \a parent argument specifies the parent the created instance will have. Omitting the
parameter or passing null will create anobject with no parent. In this case, a reference parameter or passing null will create an object with no parent. In this case, a reference
to the created object must be maintained by the application of the object will eventually to the created object must be held so that it is not destroyed by the garbage collector.
be garbage collected.
The \a properties argument is specified as a map of property-value items which will be The \a properties argument is specified as a map of property-value items which will be
set on the created object during its construction. \a mode may be Qt.Synchronous or set on the created object during its construction. \a mode may be Qt.Synchronous or
......
...@@ -275,8 +275,9 @@ QQmlImageProviderBase::~QQmlImageProviderBase() ...@@ -275,8 +275,9 @@ QQmlImageProviderBase::~QQmlImageProviderBase()
/*! /*!
\qmltype Qt \qmltype Qt
\instantiates QQmlEnginePrivate \inqmlmodule QtQml 2
\ingroup qml-utility-elements \instantiates QQmlEnginePrivate
\ingroup qml-utility-elements
\brief The QML global Qt object provides useful enums and functions from Qt. \brief The QML global Qt object provides useful enums and functions from Qt.
\keyword QmlGlobalQtObject \keyword QmlGlobalQtObject
...@@ -1278,7 +1279,9 @@ void QQmlEnginePrivate::doDeleteInEngineThread() ...@@ -1278,7 +1279,9 @@ void QQmlEnginePrivate::doDeleteInEngineThread()
delete d; delete d;
} }
Q_AUTOTEST_EXPORT void qmlExecuteDeferred(QObject *object) namespace QtQml {
void qmlExecuteDeferred(QObject *object)
{ {
QQmlData *data = QQmlData::get(object); QQmlData *data = QQmlData::get(object);
...@@ -1351,6 +1354,41 @@ QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object, ...@@ -1351,6 +1354,41 @@ QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
return qmlAttachedPropertiesObjectById(*idCache, object, create); return qmlAttachedPropertiesObjectById(*idCache, object, create);
} }
} // namespace QtQml
#if QT_DEPRECATED_SINCE(5, 1)
// Also define symbols outside namespace to keep binary compatibility with Qt 5.0
Q_QML_EXPORT void qmlExecuteDeferred(QObject *obj)
{
QtQml::qmlExecuteDeferred(obj);
}
Q_QML_EXPORT QQmlContext *qmlContext(const QObject *obj)
{
return QtQml::qmlContext(obj);
}
Q_QML_EXPORT QQmlEngine *qmlEngine(const QObject *obj)
{
return QtQml::qmlEngine(obj);
}
Q_QML_EXPORT QObject *qmlAttachedPropertiesObjectById(int id, const QObject *obj, bool create)
{
return QtQml::qmlAttachedPropertiesObjectById(id, obj, create);
}
Q_QML_EXPORT QObject *qmlAttachedPropertiesObject(int *idCache, const QObject *object,
const QMetaObject *attachedMetaObject,
bool create)
{
return QtQml::qmlAttachedPropertiesObject(idCache, object, attachedMetaObject, create);
}
#endif // QT_DEPRECATED_SINCE(5, 1)
QQmlDebuggingEnabler::QQmlDebuggingEnabler(bool printWarning) QQmlDebuggingEnabler::QQmlDebuggingEnabler(bool printWarning)
{ {
#ifndef QQML_NO_DEBUG_PROTOCOL #ifndef QQML_NO_DEBUG_PROTOCOL
......
...@@ -54,10 +54,10 @@ QT_BEGIN_NAMESPACE ...@@ -54,10 +54,10 @@ QT_BEGIN_NAMESPACE
QQmlExtensionPlugin is a plugin interface that makes it possible to QQmlExtensionPlugin is a plugin interface that makes it possible to
create QML extensions that can be loaded dynamically into QML applications. create QML extensions that can be loaded dynamically into QML applications.
These extensions allow custom QML types to be made available to the QML engine. These extensions allow custom QML types to be made available to the QML engine.
To write a QML extension plugin: To write a QML extension plugin:
\list \list
\li Subclass QQmlExtensionPlugin, implement registerTypes() method to register types \li Subclass QQmlExtensionPlugin, implement registerTypes() method to register types
using qmlRegisterType(), and export the class using the Q_PLUGIN_METADATA() macro using qmlRegisterType(), and export the class using the Q_PLUGIN_METADATA() macro
...@@ -74,10 +74,10 @@ QT_BEGIN_NAMESPACE ...@@ -74,10 +74,10 @@ QT_BEGIN_NAMESPACE
\section1 An example \section1 An example
Suppose there is a new \c TimeModel C++ class that should be made available Suppose there is a new \c TimeModel C++ class that should be made available
as a new QML element. It provides the current time through \c hour and \c minute as a new QML element. It provides the current time through \c hour and \c minute
properties, like this: properties, like this:
\snippet qml/plugins/plugin.cpp 0 \snippet plugins/plugin.cpp 0
\dots \dots
To make this class available as a QML type, create a plugin that registers To make this class available as a QML type, create a plugin that registers
...@@ -85,13 +85,13 @@ QT_BEGIN_NAMESPACE ...@@ -85,13 +85,13 @@ QT_BEGIN_NAMESPACE
module will be named \c TimeExample (as defined in the project module will be named \c TimeExample (as defined in the project
file further below). file further below).
\snippet qml/plugins/plugin.cpp plugin \snippet plugins/plugin.cpp plugin
This registers the \c TimeModel class with the 1.0 version of this This registers the \c TimeModel class with the 1.0 version of this
plugin library, as a QML type called \c Time. The Q_ASSERT statement plugin library, as a QML type called \c Time. The Q_ASSERT statement
ensures the module is imported correctly by any QML components that use this plugin. ensures the module is imported correctly by any QML components that use this plugin.
The project file defines the project as a plugin library and specifies The project file defines the project as a plugin library and specifies
it should be built into the \c imports/TimeExample directory: it should be built into the \c imports/TimeExample directory:
\code \code
...@@ -102,19 +102,19 @@ QT_BEGIN_NAMESPACE ...@@ -102,19 +102,19 @@ QT_BEGIN_NAMESPACE
DESTDIR = imports/TimeExample DESTDIR = imports/TimeExample
TARGET = qmlqtimeexampleplugin TARGET = qmlqtimeexampleplugin
... ...
\endcode \endcode
Finally, a \l{Module Definition qmldir Files}{qmldir file} is required in the \c imports/TimeExample directory Finally, a \l{Module Definition qmldir Files}{qmldir file} is required in the \c imports/TimeExample directory
that describes the plugin. This directory includes a \c Clock.qml file that that describes the plugin. This directory includes a \c Clock.qml file that
should be bundled with the plugin, so it needs to be specified in the \c qmldir should be bundled with the plugin, so it needs to be specified in the \c qmldir
file: file:
\quotefile qml/plugins/imports/TimeExample/qmldir \quotefile plugins/imports/TimeExample/qmldir
Once the project is built and installed, the new \c Time element can be Once the project is built and installed, the new \c Time element can be
used by any QML component that imports the \c TimeExample module: used by any QML component that imports the \c TimeExample module:
\snippet qml/plugins/plugins.qml 0 \snippet plugins/plugins.qml 0
The full source code is available in the \l {qml/plugins}{plugins example}. The full source code is available in the \l {qml/plugins}{plugins example}.
...@@ -134,7 +134,7 @@ QT_BEGIN_NAMESPACE ...@@ -134,7 +134,7 @@ QT_BEGIN_NAMESPACE
plugin. plugin.
The \a uri is an identifier for the plugin generated by the QML engine The \a uri is an identifier for the plugin generated by the QML engine
based on the name and path of the extension's plugin library. based on the name and path of the extension's plugin library.
*/ */
/*! /*!
......
...@@ -165,6 +165,8 @@ QQmlInfo::~QQmlInfo() ...@@ -165,6 +165,8 @@ QQmlInfo::~QQmlInfo()
} }
} }
namespace QtQml {
QQmlInfo qmlInfo(const QObject *me) QQmlInfo qmlInfo(const QObject *me)
{ {
QQmlInfoPrivate *d = new QQmlInfoPrivate; QQmlInfoPrivate *d = new QQmlInfoPrivate;
...@@ -188,5 +190,27 @@ QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors) ...@@ -188,5 +190,27 @@ QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors)
return QQmlInfo(d); return QQmlInfo(d);
} }
} // namespace QtQml
#if QT_DEPRECATED_SINCE(5, 1)
// Also define symbols outside namespace to keep binary compatibility with Qt 5.0
QQmlInfo qmlInfo(const QObject *me)
{
return QtQml::qmlInfo(me);
}
QQmlInfo qmlInfo(const QObject *me, const QQmlError &error)
{
return QtQml::qmlInfo(me, error);
}
QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors)
{
return QtQml::qmlInfo(me, errors);
}
#endif // QT_DEPRECATED_SINCE(5, 1)
QT_END_NAMESPACE QT_END_NAMESPACE
...@@ -48,6 +48,15 @@ ...@@ -48,6 +48,15 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QQmlInfo;
namespace QtQml {
// declared in namespace to avoid symbol conflicts with QtDeclarative
Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me);
Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QQmlError &error);
Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors);
}
using namespace QtQml;
class QQmlInfoPrivate; class QQmlInfoPrivate;
class Q_QML_EXPORT QQmlInfo : public QDebug class Q_QML_EXPORT QQmlInfo : public QDebug
...@@ -82,18 +91,14 @@ public: ...@@ -82,18 +91,14 @@ public:
#endif #endif
private: private:
friend Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me); friend Q_QML_EXPORT QQmlInfo QtQml::qmlInfo(const QObject *me);
friend Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QQmlError &error); friend Q_QML_EXPORT QQmlInfo QtQml::qmlInfo(const QObject *me, const QQmlError &error);
friend Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors); friend Q_QML_EXPORT QQmlInfo QtQml::qmlInfo(const QObject *me, const QList<QQmlError> &errors);
QQmlInfo(QQmlInfoPrivate *); QQmlInfo(QQmlInfoPrivate *);
QQmlInfoPrivate *d; QQmlInfoPrivate *d;
}; };
Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me);
Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QQmlError &error);
Q_QML_EXPORT QQmlInfo qmlInfo(const QObject *me, const QList<QQmlError> &errors);
QT_END_NAMESPACE QT_END_NAMESPACE
#endif // QQMLINFO_H #endif // QQMLINFO_H
...@@ -772,10 +772,10 @@ V8_DEFINE_EXTENSION(QV8LocaleDataDeletable, localeV8Data); ...@@ -772,10 +772,10 @@ V8_DEFINE_EXTENSION(QV8LocaleDataDeletable, localeV8Data);
\inqmlmodule QtQml 2 \inqmlmodule QtQml 2
\brief Provides locale specific properties and formatted data \brief Provides locale specific properties and formatted data
The Locale object may only be created via the \l{QML:Qt::locale()}{Qt.locale()} function. The Locale object may only be created via the \l{QtQml2::Qt::locale()}{Qt.locale()} function.
It cannot be created directly. It cannot be created directly.
The \l{QML:Qt::locale()}{Qt.locale()} function returns a JS Locale object representing the The \l{QtQml2::Qt::locale()}{Qt.locale()} function returns a JS Locale object representing the
locale with the specified name, which has the format locale with the specified name, which has the format
"language[_territory][.codeset][@modifier]" or "C". "language[_territory][.codeset][@modifier]" or "C".
......
...@@ -231,7 +231,7 @@ private: ...@@ -231,7 +231,7 @@ private:
friend int registerSingletonType(const QQmlPrivate::RegisterSingletonType &); friend int registerSingletonType(const QQmlPrivate::RegisterSingletonType &);
friend int registerInterface(const QQmlPrivate::RegisterInterface &); friend int registerInterface(const QQmlPrivate::RegisterInterface &);
friend int registerCompositeType(const QQmlPrivate::RegisterCompositeType &); friend int registerCompositeType(const QQmlPrivate::RegisterCompositeType &);
friend void qmlClearTypeRegistrations(); friend Q_QML_EXPORT void qmlClearTypeRegistrations();
QQmlType(int, const QQmlPrivate::RegisterInterface &); QQmlType(int, const QQmlPrivate::RegisterInterface &);
QQmlType(int, const QString &, const QQmlPrivate::RegisterSingletonType &); QQmlType(int, const QString &, const QQmlPrivate::RegisterSingletonType &);
QQmlType(int, const QString &, const QQmlPrivate::RegisterType &); QQmlType(int, const QString &, const QQmlPrivate::RegisterType &);
...@@ -260,7 +260,7 @@ private: ...@@ -260,7 +260,7 @@ private:
//Used by register functions and creates the QQmlTypeModule for them //Used by register functions and creates the QQmlTypeModule for them
friend void addTypeToData(QQmlType* type, QQmlMetaTypeData *data); friend void addTypeToData(QQmlType* type, QQmlMetaTypeData *data);
friend struct QQmlMetaTypeData; friend struct QQmlMetaTypeData;
friend void qmlClearTypeRegistrations(); friend Q_QML_EXPORT void qmlClearTypeRegistrations();
QQmlTypeModule(); QQmlTypeModule();
~QQmlTypeModule(); ~QQmlTypeModule();
......
...@@ -638,7 +638,14 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast) ...@@ -638,7 +638,14 @@ bool QV4IRBuilder::visit(AST::FieldMemberExpression *ast)
QByteArray utf8Name = name.toUtf8(); QByteArray utf8Name = name.toUtf8();
const char *enumName = utf8Name.constData(); const char *enumName = utf8Name.constData();
const QMetaObject *meta = baseName->meta.propertyCache(m_engine)->firstCppMetaObject(); const QQmlPropertyCache *cache = baseName->meta.propertyCache(m_engine);
if (!cache) {
//Happens in some cases where they make properties with uppercase names
qFatal("QV4: Unable to resolve enum: '%s'",
QString(*baseName->id + QLatin1Char('.') + ast->name.toString()).toLatin1().constData());
}
const QMetaObject *meta = cache->firstCppMetaObject();
bool found = false; bool found = false;
for (int ii = 0; !found && ii < meta->enumeratorCount(); ++ii) { for (int ii = 0; !found && ii < meta->enumeratorCount(); ++ii) {
QMetaEnum e = meta->enumerator(ii); QMetaEnum e = meta->enumerator(ii);
......
...@@ -821,7 +821,7 @@ to \c format. ...@@ -821,7 +821,7 @@ to \c format.
The \a date parameter may be a JavaScript \c Date object, a \l{date}{date} The \a date parameter may be a JavaScript \c Date object, a \l{date}{date}
property, a QDate, or QDateTime value. The \a format parameter may be any of property, a QDate, or QDateTime value. The \a format parameter may be any of
the possible format values as described for the possible format values as described for
\l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}. \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}.
If \a format is not specified, \a date is formatted using If \a format is not specified, \a date is formatted using
\l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}. \l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}.
...@@ -862,7 +862,7 @@ Returns a string representation of \c time, optionally formatted according to ...@@ -862,7 +862,7 @@ Returns a string representation of \c time, optionally formatted according to
The \a time parameter may be a JavaScript \c Date object, a QTime, or QDateTime The \a time parameter may be a JavaScript \c Date object, a QTime, or QDateTime
value. The \a format parameter may be any of the possible format values as value. The \a format parameter may be any of the possible format values as
described for \l{QML:Qt::formatDateTime()}{Qt.formatDateTime()}. described for \l{QtQml2::Qt::formatDateTime()}{Qt.formatDateTime()}.
If \a format is not specified, \a time is formatted using If \a format is not specified, \a time is formatted using
\l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}. \l {Qt::DefaultLocaleShortDate}{Qt.DefaultLocaleShortDate}.
...@@ -978,7 +978,7 @@ For example, if the following date/time value was specified: ...@@ -978,7 +978,7 @@ For example, if the following date/time value was specified:
\endcode \endcode
This \a dateTime value could be passed to \c Qt.formatDateTime(), This \a dateTime value could be passed to \c Qt.formatDateTime(),
\l {QML:Qt::formatDate()}{Qt.formatDate()} or \l {QML:Qt::formatTime()}{Qt.formatTime()} \l {QtQml2::Qt::formatDate()}{Qt.formatDate()} or \l {QtQml2::Qt::formatTime()}{Qt.formatTime()}
with the \a format values below to produce the following results: with the \a format values below to produce the following results:
\table \table
...@@ -1138,7 +1138,7 @@ For example, if the above snippet had misspelled color as 'colro' then the array ...@@ -1138,7 +1138,7 @@ For example, if the above snippet had misspelled color as 'colro' then the array
Note that this function returns immediately, and therefore may not work if Note that this function returns immediately, and therefore may not work if
the \a qml string loads new components (that is, external QML files that have not yet been loaded). the \a qml string loads new components (that is, external QML files that have not yet been loaded).
If this is the case, consider using \l{QML:Qt::createComponent()}{Qt.createComponent()} instead. If this is the case, consider using \l{QtQml2::Qt::createComponent()}{Qt.createComponent()} instead.
See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function. See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function.
*/ */
...@@ -1264,7 +1264,7 @@ For example: ...@@ -1264,7 +1264,7 @@ For example:
See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function. See \l {Dynamic QML Object Creation from JavaScript} for more information on using this function.
To create a QML object from an arbitrary string of QML (instead of a file), To create a QML object from an arbitrary string of QML (instead of a file),
use \l{QML:Qt::createQmlObject()}{Qt.createQmlObject()}. use \l{QtQml2::Qt::createQmlObject()}{Qt.createQmlObject()}.
*/ */
v8::Handle<v8::Value> createComponent(const v8::Arguments &args) v8::Handle<v8::Value> createComponent(const v8::Arguments &args)
{ {
...@@ -1344,7 +1344,7 @@ v8::Handle<v8::Value> createComponent(const v8::Arguments &args) ...@@ -1344,7 +1344,7 @@ v8::Handle<v8::Value> createComponent(const v8::Arguments &args)
Example: Example:
\snippet qml/qsTranslate.qml 0 \snippet qml/qsTranslate.qml 0
\sa {Localization And Internationalization Support In Qt Quick} \sa {Internationalization and Localization with Qt Quick}
*/ */
v8::Handle<v8::Value> qsTranslate(const v8::Arguments &args) v8::Handle<v8::Value> qsTranslate(const v8::Arguments &args)
{ {
...@@ -1401,7 +1401,7 @@ v8::Handle<v8::Value> qsTranslate(const v8::Arguments &args) ...@@ -1401,7 +1401,7 @@ v8::Handle<v8::Value> qsTranslate(const v8::Arguments &args)
Example: Example:
\snippet qml/qtTranslateNoOp.qml 0 \snippet qml/qtTranslateNoOp.qml 0
\sa {Localization And Internationalization Support In Qt Quick} \sa {Internationalization and Localization with Qt Quick}
*/ */
v8::Handle<v8::Value> qsTranslateNoOp(const v8::Arguments &args) v8::Handle<v8::Value> qsTranslateNoOp(const v8::Arguments &args)
{ {
...@@ -1425,7 +1425,7 @@ v8::Handle<v8::Value> qsTranslateNoOp(const v8::Arguments &args) ...@@ -1425,7 +1425,7 @@ v8::Handle<v8::Value> qsTranslateNoOp(const v8::Arguments &args)
Example: Example:
\snippet qml/qsTr.qml 0 \snippet qml/qsTr.qml 0
\sa {Localization And Internationalization Support In Qt Quick} \sa {Internationalization and Localization with Qt Quick}
*/ */
v8::Handle<v8::Value> qsTr(const v8::Arguments &args) v8::Handle<v8::Value> qsTr(const v8::Arguments &args)
{ {
...@@ -1479,7 +1479,7 @@ v8::Handle<v8::Value> qsTr(const v8::Arguments &args) ...@@ -1479,7 +1479,7 @@ v8::Handle<v8::Value> qsTr(const v8::Arguments &args)
Example: Example:
\snippet qml/qtTrNoOp.qml 0 \snippet qml/qtTrNoOp.qml 0
\sa {Localization And Internationalization Support In Qt Quick} \sa {Internationalization and Localization with Qt Quick}
*/ */
v8::Handle<v8::Value> qsTrNoOp(const v8::Arguments &args) v8::Handle<v8::Value> qsTrNoOp(const v8::Arguments &args)
{ {
...@@ -1516,7 +1516,7 @@ v8::Handle<v8::Value> qsTrNoOp(const v8::Arguments &args) ...@@ -1516,7 +1516,7 @@ v8::Handle<v8::Value> qsTrNoOp(const v8::Arguments &args)
Creating binary translation (QM) files suitable for use with this function requires passing Creating binary translation (QM) files suitable for use with this function requires passing
the \c -idbased option to the \c lrelease tool. the \c -idbased option to the \c lrelease tool.
\sa QT_TRID_NOOP, {Localization And Internationalization Support In Qt Quick} \sa QT_TRID_NOOP, {Internationalization and Localization with Qt Quick}
*/ */
v8::Handle<v8::Value> qsTrId(const v8::Arguments &args) v8::Handle<v8::Value> qsTrId(const v8::Arguments &args)
{ {
...@@ -1549,7 +1549,7 @@ v8::Handle<v8::Value> qsTrId(const v8::Arguments &args) ...@@ -1549,7 +1549,7 @@ v8::Handle<v8::Value> qsTrId(const v8::Arguments &args)
Example: Example:
\snippet qml/qtTrIdNoOp.qml 0 \snippet qml/qtTrIdNoOp.qml 0
\sa qsTrId(), {Localization And Internationalization Support In Qt Quick} \sa qsTrId(), {Internationalization and Localization with Qt Quick}
*/ */
v8::Handle<v8::Value> qsTrIdNoOp(const v8::Arguments &args) v8::Handle<v8::Value> qsTrIdNoOp(const v8::Arguments &args)
{ {
......
...@@ -157,7 +157,7 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent) ...@@ -157,7 +157,7 @@ QQmlDelegateModelParts::QQmlDelegateModelParts(QQmlDelegateModel *parent)
The example below illustrates using a DelegateModel with a ListView. The example below illustrates using a DelegateModel with a ListView.
\snippet qml/visualdatamodel.qml 0 \snippet delegatemodel/visualdatamodel.qml 0
*/ */
QQmlDelegateModelPrivate::QQmlDelegateModelPrivate(QQmlContext *ctxt) QQmlDelegateModelPrivate::QQmlDelegateModelPrivate(QQmlContext *ctxt)
...@@ -397,10 +397,10 @@ void QQmlDelegateModel::setDelegate(QQmlComponent *delegate) ...@@ -397,10 +397,10 @@ void QQmlDelegateModel::setDelegate(QQmlComponent *delegate)
the new directory's contents. the new directory's contents.
\c main.cpp: \c main.cpp:
\snippet qml/visualdatamodel_rootindex/main.cpp 0 \snippet delegatemodel/visualdatamodel_rootindex/main.cpp 0
\c view.qml: \c view.qml:
\snippet qml/visualdatamodel_rootindex/view.qml 0 \snippet delegatemodel/visualdatamodel_rootindex/view.qml 0
If the \l model is a QAbstractItemModel subclass, the delegate can also If the \l model is a QAbstractItemModel subclass, the delegate can also
reference a \c hasModelChildren property (optionally qualified by a reference a \c hasModelChildren property (optionally qualified by a
...@@ -604,7 +604,7 @@ QQmlDelegateModelGroup *QQmlDelegateModelPrivate::group_at( ...@@ -604,7 +604,7 @@ QQmlDelegateModelGroup *QQmlDelegateModelPrivate::group_at(
The following example illustrates using groups to select items in a model. The following example illustrates using groups to select items in a model.
\snippet qml/visualdatagroup.qml 0 \snippet delegatemodel/visualdatagroup.qml 0
*/ */
QQmlListProperty<QQmlDelegateModelGroup> QQmlDelegateModel::groups() QQmlListProperty<QQmlDelegateModelGroup> QQmlDelegateModel::groups()
...@@ -966,7 +966,7 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, bo ...@@ -966,7 +966,7 @@ QObject *QQmlDelegateModelPrivate::object(Compositor::Group group, int index, bo
/* /*
If asynchronous is true or the component is being loaded asynchronously due If asynchronous is true or the component is being loaded asynchronously due
to an ancestor being loaded asynchronously, item() may return 0. In this to an ancestor being loaded asynchronously, item() may return 0. In this
case itemCreated() will be emitted when the item is available. The item case createdItem() will be emitted when the item is available. The item
at this stage does not have any references, so item() must be called again at this stage does not have any references, so item() must be called again
to ensure a reference is held. Any call to item() which returns a valid item to ensure a reference is held. Any call to item() which returns a valid item
must be matched by a call to release() in order to destroy the item. must be matched by a call to release() in order to destroy the item.
......
...@@ -75,11 +75,11 @@ public: ...@@ -75,11 +75,11 @@ public:
void _q_createdItem(int, QObject *); void _q_createdItem(int, QObject *);
void _q_modelUpdated(const QQmlChangeSet &, bool); void _q_modelUpdated(const QQmlChangeSet &, bool);
bool componentComplete; bool componentComplete:1;
bool effectiveReset; bool effectiveReset:1;
bool active; bool active:1;
bool async; bool async:1;
bool ownModel; bool ownModel:1;
QVariant model; QVariant model;
QQmlInstanceModel *instanceModel; QQmlInstanceModel *instanceModel;
QQmlComponent *delegate; QQmlComponent *delegate;
......
...@@ -42,7 +42,7 @@ import QtQuick 2.0 ...@@ -42,7 +42,7 @@ import QtQuick 2.0
Rectangle { Rectangle {
width: 160; height: 250 width: 160; height: 250
Image { Image {
width: 160; height: 200 width: 160; height: 200
source: "pics/checker.svg" source: "pics/checker.svg"
......