Closed skyw8 closed 10 months ago
你的ItemsAdmin.qml不是单例。添加一个qmldir文件。https://github.com/zhuzichu520/FluentUI/blob/dfb80e70eefe81091f76d2b4e137e41c3af8d782/example/qml/global/qmldir#L1
如果你不使用单例的话,可以将ItemsAdmin.qml代码放到AdminWindow.qml中,然后用id添加到FluNavigationView的items上
singleton ItemsAdmin 1.0 ItemsAdmin.qml
singleton ItemsUsr 1.0 ItemsUsr.qml
singleton ItemsFooter 1.0 ItemsFooter.qml
添加了之后似乎不管用 经过反复测试 , 我主要发现这个问题
import "qrc:/meeting_room_rsv/qml/global"
import "qrc:/meeting_room_rsv/qml/viewmodel"
我注释掉这两行运行没有任何提示报错
但是在example中注释掉
import "qrc:/example/qml/global"
会报错
qrc:/example/qml/window/MainWindow.qml:221: ReferenceError: ItemsOriginal is not defined
qrc:/example/qml/window/MainWindow.qml:180: ReferenceError: Lang is not defined
qrc:/example/qml/window/MainWindow.qml:197: ReferenceError: ItemsFooter is not defined
qrc:/example/qml/window/MainWindow.qml:196: ReferenceError: ItemsOriginal is not defined
注释掉
import "qrc:///example/qml/viewmodel"
会报错
QList(qrc:/example/qml/window/MainWindow.qml:23:5: SettingsViewModel is not a type
SettingsViewModel{
^)
应该是是import有问题,花了很长时间但不知道如何解决 项目地址 使用Qt6.60 MSVC2019 AdminWindow.qml
ItemsFooter.qml
运行后打印不了settings page,
赋值有问题,footerItems是null
下面是自己仿照写的cmake