QML 在使用 Treeview 時用C++繼承自QAbstractItemModel的資料模型,在加載時出現一大堆警告:
"Could not convert argument 2 at"
"expression for index@file:///D:/Qt/Qt5.12.3/5.12.3/mingw73_32/qml/QtQuick/Controls/Private/TreeViewItemDelegateLoader.qml:84"
"expression for onCompleted@file:///D:/Qt/Qt5.12.3/5.12.3/mingw73_32/qml/QtQuick/Controls/Private/BasicTableView.qml:546"
"Passing incompatible arguments to C++ functions from JavaScript is dangerous and deprecated."
"This will throw a JavaScript TypeError in future releases of Qt!"
因為 虛函式 QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const;
最后一個默認引數是QModelIndex()而不是null,所以我把TreeViewItemDelegateLoader.qml的這一行null注釋掉了,但還是會警告。
readonly property var index: model ? model["_q_TreeView_ModelIndex"] : __treeModel.index(-1,-1)//,null
請問有什么可以徹底解決的辦法?
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/43956.html
標籤:Qt
