Details
-
Technical task
-
Resolution: Fixed
-
Not Evaluated
-
a1569fa21 (dev), f4c8edf20 (6.5)
Description
Code
import QtQuick import QtQuick.Controls.Basic Window { width: 640 height: 480 visible: true StackView { id: stack } function get1(): void { // OK stack.get(0) } function get2(): void { // Error stack.get(0, StackView.DontLoad) } function find2(): void { // Error stack.find(function(item) { return false; }, StackView.DontLoad) } }
Compiler output
Warning: main.qml:17:15: Could not compile function get2: No matching override found. Candidates: Function expects 1 arguments, but 2 were provided type LoadBehavior for argument 1 cannot be resolved [compiler] stack.get(0, StackView.DontLoad) ^^^ Warning: main.qml:20:10: Could not compile function find2: No matching override found. Candidates: Function expects 1 arguments, but 2 were provided type LoadBehavior for argument 1 cannot be resolved [compiler] stack.find(function(item) { ^^^^
Analysis
This occurs because the signatures of the invokable functions do not use fully-qualified types (see https://github.com/qt/qtdeclarative/blob/v6.5.0/src/quicktemplates/qquickstackview_p.h#L93-L94 )
clazy-standalone v1.11 with LLVM v15.0.0 (from Qt Creator 9.0.1) produces the following warnings:
warning: invokable arguments need to be fully-qualified (QQuickStackView::LoadBehavior instead of LoadBehavior) [-Wclazy-fully-qualified-moc-types] Q_INVOKABLE QQuickItem *get(int index, LoadBehavior behavior = DontLoad); ^ warning: invokable arguments need to be fully-qualified (QQuickStackView::LoadBehavior instead of LoadBehavior) [-Wclazy-fully-qualified-moc-types] Q_INVOKABLE QQuickItem *find(const QJSValue &callback, LoadBehavior behavior = DontLoad); ^
Attachments
Issue Links
- relates to
-
QTBUG-112603 StackView.find() cannot be compiled by qmlsc
-
- Reported
-