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
QmlPropertyArguments Class Reference

Helper class for parsing QML property arguments. More...

#include <qmlpropertyarguments.h>

Collaboration diagram for QmlPropertyArguments:

Public Types

enum class  ParsingOptions { None = 0x0 , RequireQualifiedPath = 0x1 , IgnoreType = 0x2 }
 \value None No options specified. More...

Static Public Member Functions

static std::optional< QmlPropertyArgumentsparse (const QString &arg, const Location &loc, ParsingOptions opts=ParsingOptions::None)
 Parses a QML property from the input string str, with parsing options opts.

Public Attributes

QString m_type {}
QString m_module {}
QString m_qmltype {}
QString m_name {}
bool m_isList { false }

Friends

ParsingOptions operator& (ParsingOptions lhs, ParsingOptions rhs)
ParsingOptions operator| (ParsingOptions lhs, ParsingOptions rhs)

Detailed Description

Helper class for parsing QML property arguments.

Definition at line 15 of file qmlpropertyarguments.h.

Member Enumeration Documentation

◆ ParsingOptions

\value None No options specified.

\value RequireQualifiedPath Require the path segment to be qualified with a QML type name. \value IgnoreType Don’t require a type segment when parsing.

See also
parse()
Enumerator
None 
RequireQualifiedPath 
IgnoreType 

Definition at line 17 of file qmlpropertyarguments.h.

Member Function Documentation

◆ parse()

std::optional< QmlPropertyArguments > QmlPropertyArguments::parse ( const QString & str,
const Location & loc,
ParsingOptions opts = ParsingOptions::None )
static

Parses a QML property from the input string str, with parsing options opts.

str contains the argument string passed to e.g. the \qmlproperty command.

A valid QML property has the following syntax:

\badcode <type> <QML-type>::<name> <type> <QML-module>::<QML-type>::<name>

In addition, if parsing option RequireQualifiedPath is not set, the following is also accepted:

\badcode <type> <name>

{ <type>} can be omitted if IgnoreType option is set.

This syntax is accepted in QmlDocVisitor where the associated QML type is already known.

Returns a populated QmlPropertyArguments container with the property type (m_type), whether the type is a list type (m_isList), property name (m_name), and optionally, the parent QML type name (m_qmltype) and QML module name (m_module) if those were present in the argument string.

If the argument string is incorrect, outputs a warning using loc and returns nullopt.

Definition at line 62 of file qmlpropertyarguments.cpp.

Referenced by CppCodeParser::processQmlProperties().

Here is the caller graph for this function:

◆ operator&

ParsingOptions operator& ( ParsingOptions lhs,
ParsingOptions rhs )
friend

Definition at line 33 of file qmlpropertyarguments.h.

References operator&.

Referenced by operator&.

◆ operator|

ParsingOptions operator| ( ParsingOptions lhs,
ParsingOptions rhs )
friend

Definition at line 41 of file qmlpropertyarguments.h.

References operator|.

Referenced by operator|.

Member Data Documentation

◆ m_isList

bool QmlPropertyArguments::m_isList { false }

Definition at line 27 of file qmlpropertyarguments.h.

◆ m_module

QString QmlPropertyArguments::m_module {}

Definition at line 24 of file qmlpropertyarguments.h.

◆ m_name

QString QmlPropertyArguments::m_name {}

Definition at line 26 of file qmlpropertyarguments.h.

◆ m_qmltype

QString QmlPropertyArguments::m_qmltype {}

Definition at line 25 of file qmlpropertyarguments.h.

◆ m_type

QString QmlPropertyArguments::m_type {}

Definition at line 23 of file qmlpropertyarguments.h.


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