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
qqmltcpropertyutils_p.h
Go to the documentation of this file.
1// Copyright (C) 2021 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3// Qt-Security score:significant
4
5#ifndef QQMLTCPROPERTYUTILS_P_H
6#define QQMLTCPROPERTYUTILS_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <private/qqmljsmetatypes_p.h>
20#include <private/qqmljsscope_p.h>
21#include <QtQml/private/qqmlsignalnames_p.h>
22
23QT_BEGIN_NAMESPACE
24
25namespace QQmltc {
26
27/*!
28 \internal
29
30 Returns an underlying C++ type of \a p property.
31*/
32inline QString getUnderlyingType(const QQmlJSMetaProperty &p)
33{
34 if (p.isList()) {
35 // We cannot just use p.type()->internalName() here because it may be
36 // a list property of something that only receives a C++ name from qmltc.
37 const QQmlJSScope::ConstPtr elementType = p.type()->elementType();
38 return (elementType->isReferenceType() ? u"QQmlListProperty<" : u"QList<")
39 + elementType->internalName() + u'>';
40 }
41
42 return p.type()->augmentedInternalName();
43}
44
45// simple class that, for a given property, creates information for the
46// Q_PROPERTY macro (READ/WRITE function names, etc.)
48{
49 PropertyData(const QQmlJSMetaProperty &p) : PropertyData(p.propertyName()) { }
50
51 PropertyData(const QString &propertyName)
52 {
53 read = propertyName;
54 write = QQmlSignalNames::addPrefixToPropertyName(u"set", propertyName);
55 bindable = QQmlSignalNames::addPrefixToPropertyName(u"bindable", propertyName);
56 notify = QQmlSignalNames::propertyNameToChangedSignalName(propertyName);
57 reset = QQmlSignalNames::addPrefixToPropertyName(u"reset", propertyName);
58 }
59
65};
66
67} // namespace QQmltc
68
69QT_END_NAMESPACE
70
71#endif // QQMLTCPROPERTYUTILS_P_H
static bool isImplicitComponent(const QQmlJSScope::ConstPtr &type)
void iterateBindings(const QQmlJSScope::ConstPtr &root, const QHash< QQmlJSScope::ConstPtr, QList< QQmlJSMetaPropertyBinding > > &qmlIrOrderedBindings, TypePredicate typePredicate, BindingPredicate bindingPredicate)
QSpan< const QmltcLoggingCategoryOverride > categoryOverrides()
static bool isOrUnderComponent(QQmlJSScope::ConstPtr type)
static void setAliasData(QQmlJSMetaProperty *alias, const QQmlJSUtils::ResolvedAlias &origin)
QString getUnderlyingType(const QQmlJSMetaProperty &p)
static void addCleanQmlTypeName(QStringList *names, const QQmlJSScope::ConstPtr &scope)
void iterateTypes(const QQmlJSScope::ConstPtr &root, const QHash< QQmlJSScope::ConstPtr, QList< QQmlJSMetaPropertyBinding > > &qmlIrOrderedBindings, Predicate predicate)
QQmlJSScope::ConstPtr fetchType(const QQmlJSMetaPropertyBinding &binding)
static bool isExplicitComponent(const QQmlJSScope::ConstPtr &type)
static QString uniqueNameFromPieces(const QStringList &pieces, QHash< QString, int > &repetitions)
Q_LOGGING_CATEGORY(lcEventDispatcher, "qt.eventdispatcher")
PropertyData(const QQmlJSMetaProperty &p)