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
qqmlpropertyresolver.cpp
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
5#include <private/qqmlcontextdata_p.h>
6#include <private/qqmlsignalnames_p.h>
7
9
10const QQmlPropertyData *QQmlPropertyResolver::property(
11 const QString &name, bool *notInRevision, RevisionCheck check) const
12{
13 if (notInRevision)
14 *notInRevision = false;
15
16 const QQmlPropertyData *d = cache->property(name, nullptr, nullptr);
17
18 // Find the first property
19 while (d && d->isFunction())
20 d = cache->overrideData(d);
21
22 if (check != IgnoreRevision && d && !cache->isAllowedInRevision(d)) {
23 if (notInRevision)
24 *notInRevision = true;
25 return nullptr;
26 }
27
28 return d;
29}
30
31const QQmlPropertyData *QQmlPropertyResolver::signal(
32 const QString &name, bool *notInRevision, RevisionCheck check) const
33{
34 if (notInRevision)
35 *notInRevision = false;
36
37 const QQmlPropertyData *d = cache->property(name, nullptr, nullptr);
38
39 while (d && !d->isFunction())
40 d = cache->overrideData(d);
41
42 if (check != IgnoreRevision && d && !cache->isAllowedInRevision(d)) {
43 if (notInRevision)
44 *notInRevision = true;
45 return nullptr;
46 }
47
48 if (d && d->isSignal())
49 return d;
50
51 if (const auto propName = QQmlSignalNames::changedSignalNameToPropertyName(name)) {
52 if (d = property(*propName, notInRevision, check); d)
53 return cache->signal(d->notifyIndex());
54 }
55
56 return nullptr;
57}
58
59QT_END_NAMESPACE