Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
QQmlSignalNames Class Reference

#include <qqmlsignalnames_p.h>

+ Collaboration diagram for QQmlSignalNames:

Static Public Member Functions

static QString propertyNameToChangedSignalName (QStringView property)
 
static QByteArray propertyNameToChangedSignalName (QUtf8StringView property)
 
static QString propertyNameToChangedHandlerName (QStringView property)
 
static QString signalNameToHandlerName (QAnyStringView signal)
 
static std::optional< QStringchangedSignalNameToPropertyName (QStringView changeSignal)
 
static std::optional< QByteArraychangedSignalNameToPropertyName (QUtf8StringView changeSignal)
 
static std::optional< QStringchangedHandlerNameToPropertyName (QStringView handler)
 
static std::optional< QByteArraychangedHandlerNameToPropertyName (QUtf8StringView handler)
 
static std::optional< QStringhandlerNameToSignalName (QStringView handler)
 
static std::optional< QStringchangedHandlerNameToSignalName (QStringView changedHandler)
 
static bool isChangedHandlerName (QStringView signalName)
 
static bool isChangedSignalName (QStringView signalName)
 
static bool isHandlerName (QStringView signalName)
 
static QString addPrefixToPropertyName (QStringView prefix, QStringView propertyName)
 
static std::optional< QStringbadHandlerNameToSignalName (QStringView handler)
 

Detailed Description

QQmlSignalNames contains a list of helper methods to manipulate signal names. Always try to use the most specific one, as combining them might lead to incorrect results like wrong upper/lower case, for example.

Definition at line 28 of file qqmlsignalnames_p.h.

Member Function Documentation

◆ addPrefixToPropertyName()

QString QQmlSignalNames::addPrefixToPropertyName ( QStringView prefix,
QStringView propertyName )
static

Concatenate a prefix to a property name and uppercases the first letter of the property name.

Definition at line 84 of file qqmlsignalnames.cpp.

References QString::append(), changeCaseOfFirstLetter(), QStringView::size(), QStringView::toString(), and ToUpper.

+ Here is the call graph for this function:

◆ badHandlerNameToSignalName()

std::optional< QString > QQmlSignalNames::badHandlerNameToSignalName ( QStringView handler)
static

Returns a signal name from handlerName string. Do not use it on changed handlers, see changedHandlerNameToSignalName for that! Accepts improperly capitalized handler names and incorrectly resolves signal names that start with '_' or '$'.

Definition at line 198 of file qqmlsignalnames.cpp.

References On, QStringView::size(), QStringView::sliced(), QStringView::startsWith(), and StrlenOn.

Referenced by QQmlPropertyPrivate::initProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changedHandlerNameToPropertyName() [1/2]

std::optional< QString > QQmlSignalNames::changedHandlerNameToPropertyName ( QStringView handler)
static

Returns a property name from changedHandler. This fails for property names starting with an upper-case letter, as it will lower-case it in the process.

Definition at line 144 of file qqmlsignalnames.cpp.

References changedSignalNameToPropertyName(), handlerNameToSignalName(), and isChangedHandlerName().

Referenced by expressionTypeWithDefinition(), newNameFrom(), QQmlJSUtils::propertyFromChangedHandler(), resolveNameInQmlScope(), and QQmlJSFunctionInitializer::run().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changedHandlerNameToPropertyName() [2/2]

static std::optional< QByteArray > QQmlSignalNames::changedHandlerNameToPropertyName ( QUtf8StringView handler)
static

◆ changedHandlerNameToSignalName()

std::optional< QString > QQmlSignalNames::changedHandlerNameToSignalName ( QStringView handler)
static

Returns a signal name from changedHandlerName string. Makes sure not to lowercase the 'C' from Changed.

Definition at line 216 of file qqmlsignalnames.cpp.

◆ changedSignalNameToPropertyName() [1/2]

std::optional< QString > QQmlSignalNames::changedSignalNameToPropertyName ( QStringView signalName)
static

Obtain a propertyName from its changed signal handler. Do not call this on a value obtained from handlerNameToSignalName! Instead use changedHandlerNameToPropertyName() directly. Otherwise you might end up with a wrong capitalization of _Changed for "on_Changed", for example.

Definition at line 128 of file qqmlsignalnames.cpp.

References changedSignalNameToPropertyNameTemplate(), and toQStringData().

Referenced by changedHandlerNameToPropertyName(), expressionTypeWithDefinition(), QQmlPropertyPrivate::findSignalByName(), QQmlPropertyPrivate::initProperty(), newNameFrom(), resolveNameInQmlScope(), and QQmlPropertyResolver::signal().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ changedSignalNameToPropertyName() [2/2]

std::optional< QByteArray > QQmlSignalNames::changedSignalNameToPropertyName ( QUtf8StringView changeSignal)
static

Definition at line 133 of file qqmlsignalnames.cpp.

References changedSignalNameToPropertyNameTemplate(), and toUtf8Data().

+ Here is the call graph for this function:

◆ handlerNameToSignalName()

std::optional< QString > QQmlSignalNames::handlerNameToSignalName ( QStringView handler)
static

Returns a signal name from handlerName string. Do not use it on changed handlers, see changedHandlerNameToSignalName for that!

Definition at line 187 of file qqmlsignalnames.cpp.

Referenced by changedHandlerNameToPropertyName(), expressionTypeWithDefinition(), hasValidSignal(), QQmlPropertyPrivate::initProperty(), methodFromReferrerScope(), newNameFrom(), resolveNameInQmlScope(), QQmlJSFunctionInitializer::run(), and QQmlJSImportVisitor::visit().

+ Here is the caller graph for this function:

◆ isChangedHandlerName()

bool QQmlSignalNames::isChangedHandlerName ( QStringView signalName)
static

Definition at line 232 of file qqmlsignalnames.cpp.

References Changed(), firstLetter(), On, StrlenChanged, and StrlenOn.

Referenced by changedHandlerNameToPropertyName(), and QQmlLSUtils::checkNameForRename().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isChangedSignalName()

bool QQmlSignalNames::isChangedSignalName ( QStringView signalName)
static

Definition at line 221 of file qqmlsignalnames.cpp.

References Changed(), firstLetter(), and StrlenChanged.

Referenced by QQmlLSUtils::checkNameForRename().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isHandlerName()

bool QQmlSignalNames::isHandlerName ( QStringView signalName)
static

Definition at line 246 of file qqmlsignalnames.cpp.

References firstLetter(), On, and StrlenOn.

Referenced by checkArgumentsObjectUseInSignalHandlers(), QQmlLSUtils::checkNameForRename(), QQuickPropertyChangesPrivate::decodeBinding(), handlerNameToSignalNameHelper(), QQmlJS::Dom::Binding::isSignalHandler(), QuickTestUtil::Q_REVISION(), QQmlJSFunctionInitializer::run(), and QQmlConnectionsParser::verifyBindings().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ propertyNameToChangedHandlerName()

QString QQmlSignalNames::propertyNameToChangedHandlerName ( QStringView property)
static

Definition at line 101 of file qqmlsignalnames.cpp.

References property, propertyNameToChangedSignalName(), and signalNameToHandlerName().

Referenced by namesOfPossibleUsages(), and QQmlLSUtils::renameUsagesOf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ propertyNameToChangedSignalName() [1/2]

QString QQmlSignalNames::propertyNameToChangedSignalName ( QStringView property)
static

Definition at line 91 of file qqmlsignalnames.cpp.

References Changed().

Referenced by QQmlPropertyCacheCreator< ObjectContainer >::createMetaObject(), QQmlJSScope::insertPropertyIdentifier(), namesOfPossibleUsages(), propertyNameToChangedHandlerName(), and QQmlLSUtils::renameUsagesOf().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ propertyNameToChangedSignalName() [2/2]

QByteArray QQmlSignalNames::propertyNameToChangedSignalName ( QUtf8StringView property)
static

Definition at line 96 of file qqmlsignalnames.cpp.

References Changed(), property, and toUtf8Data().

+ Here is the call graph for this function:

◆ signalNameToHandlerName()

QString QQmlSignalNames::signalNameToHandlerName ( QAnyStringView signal)
static

Definition at line 155 of file qqmlsignalnames.cpp.

References changeCaseOfFirstLetter(), On, QString::reserve(), signal, StrlenOn, and ToUpper.

Referenced by QQmlPropertyCache::appendSignal(), QV4::QmlSignalHandler::call(), QQmlPropertyPrivate::initProperty(), QQmlProperty::name(), namesOfPossibleUsages(), propertyNameToChangedHandlerName(), QuickTestUtil::Q_REVISION(), QQmlLSUtils::renameUsagesOf(), signalNameToHandlerName(), and signalNameToHandlerName().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

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