Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
QQmlCustomParser Class Referenceabstract

The QQmlCustomParser class allows you to add new arbitrary types to QML. More...

#include <qqmlcustomparser_p.h>

Inheritance diagram for QQmlCustomParser:
Collaboration diagram for QQmlCustomParser:

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::CompiledData::CompilationUnit > &, const QList< const QV4::CompiledData::Binding * > &)=0
virtual void applyBindings (QObject *, const QQmlRefPointer< QV4::ExecutableCompilationUnit > &, const QList< const QV4::CompiledData::Binding * > &)=0
QVector< QQmlErrorerrors () 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 QMetaObjectresolveType (const QString &) const
 Resolves name to a type, or 0 if it is not a type.
QQmlTypeLoadertypeLoader () const

Friends

class QQmlPropertyValidator
class QQmlObjectCreator

Detailed Description

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:

QML_REGISTER_CUSTOM_TYPE(Module, MajorVersion, MinorVersion, Name, TypeClass, ParserClass)
std::list< QString >::iterator Name
Definition lalr.h:28

Definition at line 29 of file qqmlcustomparser_p.h.

Member Enumeration Documentation

◆ Flag

Enumerator
NoFlag 
AcceptsAttachedProperties 
AcceptsSignalHandlers 

Definition at line 32 of file qqmlcustomparser_p.h.

Constructor & Destructor Documentation

◆ QQmlCustomParser() [1/2]

QQmlCustomParser::QQmlCustomParser ( )
inline

Definition at line 39 of file qqmlcustomparser_p.h.

◆ QQmlCustomParser() [2/2]

QQmlCustomParser::QQmlCustomParser ( Flags f)
inline

Definition at line 40 of file qqmlcustomparser_p.h.

◆ ~QQmlCustomParser()

virtual QQmlCustomParser::~QQmlCustomParser ( )
inlinevirtual

Definition at line 41 of file qqmlcustomparser_p.h.

Member Function Documentation

◆ applyBindings()

virtual void QQmlCustomParser::applyBindings ( QObject * ,
const QQmlRefPointer< QV4::ExecutableCompilationUnit > & ,
const QList< const QV4::CompiledData::Binding * > &  )
pure virtual

◆ clearErrors()

void QQmlCustomParser::clearErrors ( )

Definition at line 57 of file qqmlcustomparser.cpp.

◆ error() [1/3]

void QQmlCustomParser::error ( const QV4::CompiledData::Binding * binding,
const QString & description )
inlineprotected

Definition at line 56 of file qqmlcustomparser_p.h.

◆ error() [2/3]

void QQmlCustomParser::error ( const QV4::CompiledData::Location & location,
const QString & description )
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.

◆ error() [3/3]

void QQmlCustomParser::error ( const QV4::CompiledData::Object * object,
const QString & description )
inlineprotected

Definition at line 58 of file qqmlcustomparser_p.h.

◆ errors()

QVector< QQmlError > QQmlCustomParser::errors ( ) const
inline

Definition at line 53 of file qqmlcustomparser_p.h.

◆ evaluateEnum()

int QQmlCustomParser::evaluateEnum ( const QString & script,
bool * ok ) const
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.

◆ flags()

Flags QQmlCustomParser::flags ( ) const
inline

Definition at line 44 of file qqmlcustomparser_p.h.

◆ resolveType()

const QMetaObject * QQmlCustomParser::resolveType ( const QString & name) const
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 203 of file qqmlcustomparser.cpp.

◆ typeLoader()

QQmlTypeLoader * QQmlCustomParser::typeLoader ( ) const
protected

Definition at line 219 of file qqmlcustomparser.cpp.

◆ verifyBindings()

virtual void QQmlCustomParser::verifyBindings ( const QQmlRefPointer< QV4::CompiledData::CompilationUnit > & ,
const QList< const QV4::CompiledData::Binding * > &  )
pure virtual

◆ QQmlObjectCreator

friend class QQmlObjectCreator
friend

Definition at line 74 of file qqmlcustomparser_p.h.

◆ QQmlPropertyValidator

friend class QQmlPropertyValidator
friend

Definition at line 73 of file qqmlcustomparser_p.h.


The documentation for this class was generated from the following files: