Details
-
Suggestion
-
Resolution: Unresolved
-
Not Evaluated
-
None
-
None
Description
Its public methods use QQmlV4Function and QJSValue as parameters or return values, which makes them uncompilable. Example at https://github.com/qt/qtdeclarative/blob/v6.5.2/src/qmlmodels/qqmllistmodel_p.h#L68-L72 :
Q_INVOKABLE void remove(QQmlV4Function *args); Q_INVOKABLE void append(QQmlV4Function *args); Q_INVOKABLE void insert(QQmlV4Function *args); Q_INVOKABLE QJSValue get(int index) const; Q_INVOKABLE void set(int index, const QJSValue &value);
Code
Adapted from https://doc.qt.io/qt-6/qml-qtquick-controls-combobox.html#accepted-signal
ComboBox { model: ListModel { id: model ListElement { text: "Apple" } ListElement { text: "Banana" } ListElement { text: "Coconut" } } Component.onCompleted: console.log("First fruit is", model.get(0).text) }
qmlsc output
Warning: Main.qml:16:69: Could not compile binding for onCompleted: Cannot generate efficient code for lookup in QJSValue [compiler] Component.onCompleted: console.log("First fruit is", model.get(0).text) ^^^^
Attachments
Issue Links
- relates to
-
QTBUG-116548 ListElement: Make enum assignments compilable by qmlsc
- Reported
- split from
-
QTBUG-105139 Remove usages of QQmlV4Function wherever possible
- Reported