QQmlSA Namespace

Provides tools for static analysis on QML programs. More...

Header: #include <QQmlSA>
CMake: find_package(Qt6 REQUIRED COMPONENTS QmlCompiler)
target_link_libraries(mytarget PRIVATE Qt6::QmlCompiler)
Status: Technical Preview

Types

enum class AccessSemantics { Reference, Value, None, Sequence }
enum class BindingType { Invalid, BoolLiteral, NumberLiteral, StringLiteral, RegExpLiteral, …, GroupProperty }
enum class MethodType { Signal, Slot, Method, StaticMethod }
enum class ScopeType { JSFunctionScope, JSLexicalScope, QMLScope, GroupedPropertyScope, AttachedPropertyScope, EnumScope }
enum class ScriptBindingKind { Invalid, PropertyBinding, SignalHandler, ChangeHandler }

Detailed Description

Type Documentation

enum class QQmlSA::AccessSemantics

Describes how a type is accessed and shared.

ConstantValueDescription
QQmlSA::AccessSemantics::Reference0The type behaves like an Object type
QQmlSA::AccessSemantics::Value1The type behaves like a Value type
QQmlSA::AccessSemantics::None2The type is a namespace, or is invalid
QQmlSA::AccessSemantics::Sequence3The type behaves like a Sequence type

See also The QML Type System.

enum class QQmlSA::BindingType

Describes the type of a QQmlSA::Binding.

ConstantValueDescription
QQmlSA::BindingType::Invalid0There is no binding
QQmlSA::BindingType::BoolLiteral1The binding is a bool literal
QQmlSA::BindingType::NumberLiteral2The binding is a number literal
QQmlSA::BindingType::StringLiteral3The binding is a string literal
QQmlSA::BindingType::RegExpLiteral4The binding is a regular expression literal
QQmlSA::BindingType::Null5The binding is a null literal
QQmlSA::BindingType::Translation6The binding is a translation
QQmlSA::BindingType::TranslationById7The binding is a translation by id
QQmlSA::BindingType::Script8The binding is a regular script
QQmlSA::BindingType::Object9The binging is an Object
QQmlSA::BindingType::Interceptor10The binding is an interceptor that can intercept writes to properties such as Behavior
QQmlSA::BindingType::ValueSource11The binging is a property value source
QQmlSA::BindingType::AttachedProperty12The binding is an attached object
QQmlSA::BindingType::GroupProperty13The binding is a grouped property

enum class QQmlSA::MethodType

Describes the type of a QQmlSA::Method.

ConstantValueDescription
QQmlSA::MethodType::Signal0The method is a signal
QQmlSA::MethodType::Slot1The method is a slot
QQmlSA::MethodType::Method2The method is a Q_INVOKABLE method
QQmlSA::MethodType::StaticMethod3The method is a Q_INVOKABLE static method

enum class QQmlSA::ScopeType

Describes the type of QML scope.

ConstantValueDescription
QQmlSA::ScopeType::JSFunctionScope0The scope is a JavaScript function:
 Item {
     function f() : int { <- begin
         return 1
     } <- end
 }
QQmlSA::ScopeType::JSLexicalScope1The scope is a JavaScript lexical scope:
 property int i: { <- begin
     let a = 1
     { <- begin
         console.log("hello")
     } <- end
     return a
 } <- end
QQmlSA::ScopeType::QMLScope2The scope is a QML Object:
 Item { <- begin
     x: 50
 } <- end
QQmlSA::ScopeType::GroupedPropertyScope3The scope is a grouped property:
 Text {
     font { <- begin
         pixelSize: 12
         bold: true
     } <- end
 }
QQmlSA::ScopeType::AttachedPropertyScope4The scope is an attached property:
 Item {
     Component.onCompleted: console.log("Hello")
     ^^^^^^^^^
              \ Scope of attached property Component
 }
QQmlSA::ScopeType::EnumScope5The scope is a QML enum:
 enum E { <- begin
     A,
     B,
     C
 } <- end

Each entry is shown with an example scope of the matching type in QML code.

enum class QQmlSA::ScriptBindingKind

Describes the script type of a QQmlSA::Binding of type Script.

ConstantValueDescription
QQmlSA::ScriptBindingKind::Invalid0The binding has an invalid script
QQmlSA::ScriptBindingKind::PropertyBinding1The binding is bound to a property
QQmlSA::ScriptBindingKind::SignalHandler2The binding is a signal handler
QQmlSA::ScriptBindingKind::ChangeHandler3The binding is a change handler