![]() |
Qt 6.x
The Qt SDK
|
The QQmlCustomParser class allows you to add new arbitrary types to QML. More...
#include <qqmlcustomparser_p.h>
Public Types | |
enum | Flag { NoFlag = 0x00000000 , AcceptsAttachedProperties = 0x00000001 , AcceptsSignalHandlers = 0x00000002 } |
Public Member Functions | |
QQmlCustomParser () | |
QQmlCustomParser (Flags f) | |
virtual | ~QQmlCustomParser () |
void | clearErrors () |
Flags | flags () const |
virtual void | verifyBindings (const QQmlRefPointer< QV4::ExecutableCompilationUnit > &, const QList< const QV4::CompiledData::Binding * > &)=0 |
virtual void | applyBindings (QObject *, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &, const QList< const QV4::CompiledData::Binding * > &)=0 |
QVector< QQmlError > | errors () const |
Protected Member Functions | |
void | error (const QV4::CompiledData::Binding *binding, const QString &description) |
void | error (const QV4::CompiledData::Object *object, const QString &description) |
void | error (const QV4::CompiledData::Location &location, const QString &description) |
Reports an error with the given description. | |
int | evaluateEnum (const QString &, bool *ok) const |
If script is a simple enumeration expression (eg. | |
const QMetaObject * | resolveType (const QString &) const |
Resolves name to a type, or 0 if it is not a type. | |
Friends | |
class | QQmlPropertyValidator |
class | QQmlObjectCreator |
The QQmlCustomParser class allows you to add new arbitrary types to QML.
By subclassing QQmlCustomParser, you can add a parser for building a particular type.
The subclass must implement compile() and setCustomData(), and register itself in the meta type system by calling the macro:
Definition at line 29 of file qqmlcustomparser_p.h.
Enumerator | |
---|---|
NoFlag | |
AcceptsAttachedProperties | |
AcceptsSignalHandlers |
Definition at line 32 of file qqmlcustomparser_p.h.
|
inline |
Definition at line 39 of file qqmlcustomparser_p.h.
|
inline |
Definition at line 40 of file qqmlcustomparser_p.h.
|
inlinevirtual |
Definition at line 41 of file qqmlcustomparser_p.h.
|
pure virtual |
Implemented in QQmlListModelParser, QQuickDesignerCustomParser, QQuickPropertyChangesParser, and QQmlConnectionsParser.
void QQmlCustomParser::clearErrors | ( | ) |
Definition at line 57 of file qqmlcustomparser.cpp.
|
inlineprotected |
Definition at line 52 of file qqmlcustomparser_p.h.
References error, and QV4::CompiledData::Binding::location.
|
protected |
Reports an error with the given description.
An error is generated referring to the location in the source file.
Definition at line 67 of file qqmlcustomparser.cpp.
References error, and qmlConvertSourceCoordinate< quint32, int >().
|
inlineprotected |
Definition at line 54 of file qqmlcustomparser_p.h.
References error.
Definition at line 49 of file qqmlcustomparser_p.h.
|
protected |
If script is a simple enumeration expression (eg.
Text.AlignLeft), returns the integer equivalent (eg. 1), and sets ok to true.
Otherwise sets ok to false.
A valid ok must be provided, or the function will assert.
Definition at line 85 of file qqmlcustomparser.cpp.
References QQmlImport::AllowRecursion, QQmlType::AnyRegistrationType, QBiPointer< T, T2 >::asT1(), QBiPointer< T, T2 >::asT2(), QByteArray::constData(), QQmlPropertyValidator::documentSourceUrl(), dot(), i, QString::indexOf(), QString::isEmpty(), QBiPointer< T, T2 >::isNull(), QBiPointer< T, T2 >::isT1(), QUrl::isValid(), QString::left(), QString::mid(), mo, QQmlEnumData::name, ok, Q_ASSERT, Q_ASSERT_X, QQmlTypeNameCache::query(), QQmlImports::resolveType(), QQmlPropertyValidator::rootPropertyCache(), QString::size(), QString::toUtf8(), and QQmlEnumData::values.
|
inline |
Definition at line 44 of file qqmlcustomparser_p.h.
|
protected |
Resolves name to a type, or 0 if it is not a type.
This can be used to type-check object nodes.
Definition at line 197 of file qqmlcustomparser.cpp.
References QBiPointer< T, T2 >::asT1(), QBiPointer< T, T2 >::isT1(), QQmlType::metaObject(), and QQmlImports::resolveType().
|
pure virtual |
Implemented in QQmlListModelParser, QQmlConnectionsParser, QQuickDesignerCustomParser, and QQuickPropertyChangesParser.
|
friend |
Definition at line 69 of file qqmlcustomparser_p.h.
|
friend |
Definition at line 68 of file qqmlcustomparser_p.h.