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
qqmljscontextualtypes.cpp
Go to the documentation of this file.
1// Copyright (C) 2026 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
6
8
9namespace QQmlJS {
10
11void ContextualTypes::setType(const QString &name, const ContextualType &type)
12{
13 auto insertName = [this, &name, &type]() {
14 if (!name.startsWith(u'$')) {
15 if (!m_names.contains(type.scope, name))
16 m_names.insert(type.scope, name);
17 }
18 };
19
20 const auto it = m_types.find(name);
21 if (it == m_types.end()) {
22 m_types.insert(name, type);
23 insertName();
24 return;
25 }
26
27 if (it->m_precedence < type.m_precedence)
28 return;
29 // remove the old name from m_names
30 m_names.remove(it->scope, name);
31 *it = type;
32 insertName();
33}
34
35} // namespace QQmlJS
36
37QT_END_NAMESPACE
Combined button and popup list for selecting options.
void setType(const QString &name, const ContextualType &type)