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
QQmlJSUtils Struct Reference

#include <qqmljsutils_p.h>

Collaboration diagram for QQmlJSUtils:

Classes

struct  AliasResolutionVisitor
struct  ResolvedAlias

Public Types

enum  PropertyAccessor { PropertyAccessor_Read , PropertyAccessor_Write }
enum  ResolvedAliasTarget { AliasTarget_Invalid , AliasTarget_Property , AliasTarget_Object }

Static Public Member Functions

template<typename String, typename CharacterLiteral, typename StringView>
static String escapeString (String s)
template<typename String = QString, typename CharacterLiteral = QLatin1Char, typename StringView = QLatin1StringView>
static String toLiteral (const String &s, StringView ctor=StringView("QStringLiteral"))
static QString constRefify (QString type)
static std::optional< QQmlJSMetaPropertychangeHandlerProperty (const QQmlJSScope::ConstPtr &scope, QStringView signalName)
static std::optional< QQmlJSMetaPropertypropertyFromChangedHandler (const QQmlJSScope::ConstPtr &scope, QStringView changedHandler)
static bool hasCompositeBase (const QQmlJSScope::ConstPtr &scope)
static bool bindablePropertyHasDefaultAccessor (const QQmlJSMetaProperty &p, PropertyAccessor accessor)
static ResolvedAlias resolveAlias (const QQmlJSTypeResolver *typeResolver, const QQmlJSMetaProperty &property, const QQmlJSScope::ConstPtr &owner, const AliasResolutionVisitor &visitor)
static ResolvedAlias resolveAlias (const QQmlJSScopesById &idScopes, const QQmlJSMetaProperty &property, const QQmlJSScope::ConstPtr &owner, const AliasResolutionVisitor &visitor)
template<typename QQmlJSScopePtr, typename Action>
static bool searchBaseAndExtensionTypes (const QQmlJSScopePtr &type, const Action &check)
template<typename Action>
static void traverseFollowingQmlIrObjectStructure (const QQmlJSScope::Ptr &root, Action act)
template<typename Action>
static void traverseFollowingMetaObjectHierarchy (const QQmlJSScope::ConstPtr &scope, const QQmlJSScope::ConstPtr &start, Action act)
static std::optional< QQmlJSFixSuggestiondidYouMean (const QString &userInput, QStringList candidates, QQmlJS::SourceLocation location)
static std::variant< QString, QQmlJS::DiagnosticMessagesourceDirectoryPath (const QQmlJSImporter *importer, const QString &buildDirectoryPath)
template<typename Container>
static void deduplicate (Container &container)
static QStringList cleanPaths (QStringList &&paths)
static QStringList resourceFilesFromBuildFolders (const QStringList &buildFolders)
static QString qmlSourcePathFromBuildPath (const QQmlJSResourceFileMapper *mapper, const QString &pathInBuildFolder)
static QString qmlBuildPathFromSourcePath (const QQmlJSResourceFileMapper *mapper, const QString &pathInBuildFolder)

Detailed Description

Definition at line 71 of file qqmljsutils_p.h.

Member Enumeration Documentation

◆ PropertyAccessor

Enumerator
PropertyAccessor_Read 
PropertyAccessor_Write 

Definition at line 154 of file qqmljsutils_p.h.

◆ ResolvedAliasTarget

Enumerator
AliasTarget_Invalid 
AliasTarget_Property 
AliasTarget_Object 

Definition at line 181 of file qqmljsutils_p.h.

Member Function Documentation

◆ bindablePropertyHasDefaultAccessor()

bool QQmlJSUtils::bindablePropertyHasDefaultAccessor ( const QQmlJSMetaProperty & p,
PropertyAccessor accessor )
inlinestatic

Returns true if p is bindable and property accessor specified by accessor is equal to "default". Returns false otherwise.

Note
This function follows BINDABLE-only properties logic (e.g. in moc)

Definition at line 165 of file qqmljsutils_p.h.

◆ changeHandlerProperty()

std::optional< QQmlJSMetaProperty > QQmlJSUtils::changeHandlerProperty ( const QQmlJSScope::ConstPtr & scope,
QStringView signalName )
inlinestatic

Definition at line 115 of file qqmljsutils_p.h.

◆ cleanPaths()

QStringList QQmlJSUtils::cleanPaths ( QStringList && paths)
inlinestatic

Definition at line 392 of file qqmljsutils_p.h.

◆ constRefify()

QString QQmlJSUtils::constRefify ( QString type)
inlinestatic

Returns type string conditionally wrapped into {const} and {&}. This function is mostly useful for code generators.

Definition at line 107 of file qqmljsutils_p.h.

◆ deduplicate()

template<typename Container>
void QQmlJSUtils::deduplicate ( Container & container)
inlinestatic

Definition at line 385 of file qqmljsutils_p.h.

◆ didYouMean()

std::optional< QQmlJSFixSuggestion > QQmlJSUtils::didYouMean ( const QString & userInput,
QStringList candidates,
QQmlJS::SourceLocation location )
static

Definition at line 104 of file qqmljsutils.cpp.

◆ escapeString()

template<typename String, typename CharacterLiteral, typename StringView>
String QQmlJSUtils::escapeString ( String s)
inlinestatic

Returns escaped version of s. This function is mostly useful for code generators.

Definition at line 78 of file qqmljsutils_p.h.

◆ hasCompositeBase()

bool QQmlJSUtils::hasCompositeBase ( const QQmlJSScope::ConstPtr & scope)
inlinestatic

Definition at line 144 of file qqmljsutils_p.h.

◆ propertyFromChangedHandler()

std::optional< QQmlJSMetaProperty > QQmlJSUtils::propertyFromChangedHandler ( const QQmlJSScope::ConstPtr & scope,
QStringView changedHandler )
inlinestatic

Definition at line 130 of file qqmljsutils_p.h.

◆ qmlBuildPathFromSourcePath()

QString QQmlJSUtils::qmlBuildPathFromSourcePath ( const QQmlJSResourceFileMapper * mapper,
const QString & pathInSourceFolder )
static

Obtains the source folder path from a build folder QML file path via the passed mapper, see also \l QQmlJSUtils::qmlSourcePathFromBuildPath.

Definition at line 335 of file qqmljsutils.cpp.

◆ qmlSourcePathFromBuildPath()

QString QQmlJSUtils::qmlSourcePathFromBuildPath ( const QQmlJSResourceFileMapper * mapper,
const QString & pathInBuildFolder )
static

Obtains the source folder path from a build folder QML file path via the passed mapper.

This works on proper QML modules when using the nested-qml-module-with-prefer-feature from 6.8 and uses a heuristic when the qmldir with the prefer entry is missing.

Definition at line 313 of file qqmljsutils.cpp.

◆ resolveAlias() [1/2]

QQmlJSUtils::ResolvedAlias QQmlJSUtils::resolveAlias ( const QQmlJSScopesById & idScopes,
const QQmlJSMetaProperty & property,
const QQmlJSScope::ConstPtr & owner,
const AliasResolutionVisitor & visitor )
static

Definition at line 92 of file qqmljsutils.cpp.

◆ resolveAlias() [2/2]

QQmlJSUtils::ResolvedAlias QQmlJSUtils::resolveAlias ( const QQmlJSTypeResolver * typeResolver,
const QQmlJSMetaProperty & property,
const QQmlJSScope::ConstPtr & owner,
const AliasResolutionVisitor & visitor )
static

Definition at line 80 of file qqmljsutils.cpp.

◆ resourceFilesFromBuildFolders()

QStringList QQmlJSUtils::resourceFilesFromBuildFolders ( const QStringList & buildFolders)
static

Definition at line 252 of file qqmljsutils.cpp.

◆ searchBaseAndExtensionTypes()

template<typename QQmlJSScopePtr, typename Action>
bool QQmlJSUtils::searchBaseAndExtensionTypes ( const QQmlJSScopePtr & type,
const Action & check )
inlinestatic

Definition at line 211 of file qqmljsutils_p.h.

◆ sourceDirectoryPath()

std::variant< QString, QQmlJS::DiagnosticMessage > QQmlJSUtils::sourceDirectoryPath ( const QQmlJSImporter * importer,
const QString & buildDirectoryPath )
static

Returns a corresponding source directory path for buildDirectoryPath Returns empty string on error

Definition at line 168 of file qqmljsutils.cpp.

◆ toLiteral()

template<typename String = QString, typename CharacterLiteral = QLatin1Char, typename StringView = QLatin1StringView>
String QQmlJSUtils::toLiteral ( const String & s,
StringView ctor = StringView("QStringLiteral") )
inlinestatic

Returns s wrapped into a literal macro specified by ctor. By default, returns a QStringLiteral-wrapped literal. This function is mostly useful for code generators.

Note
This function escapes s before wrapping it.

Definition at line 97 of file qqmljsutils_p.h.

◆ traverseFollowingMetaObjectHierarchy()

template<typename Action>
void QQmlJSUtils::traverseFollowingMetaObjectHierarchy ( const QQmlJSScope::ConstPtr & scope,
const QQmlJSScope::ConstPtr & start,
Action act )
inlinestatic

Traverses the base types and extensions of scope in the order aligned with QMetaObjects created at run time for these types and extensions (except that QQmlVMEMetaObject is ignored). start is the starting type in the hierarchy where act is applied.

Note
To call act for every type in the hierarchy, use scope->extensionType().scope as start

Definition at line 314 of file qqmljsutils_p.h.

◆ traverseFollowingQmlIrObjectStructure()

template<typename Action>
void QQmlJSUtils::traverseFollowingQmlIrObjectStructure ( const QQmlJSScope::Ptr & root,
Action act )
inlinestatic

Definition at line 282 of file qqmljsutils_p.h.


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