qrc:/main.qml:18 SButton is not a type

来源:互联网 发布:腾讯软件管理下载 编辑:程序博客网 时间:2024/05/21 10:41

QML编程,定义一个组件后,使用它时报错 qrc:/main.qml:18 SButton is not a type 


通过QTCreator添加QML File


添加完毕后,工程结构如下:



运行时报错:

Starting E:\project\qt\build-ScheduledTask-Desktop_Qt_5_8_0_MinGW_32bit-Debug\debug\ScheduledTask.exe...

QML debugging is enabled. Only use this in a safe environment.

QQmlApplicationEngine failed to load component

qrc:/main.qml:18 SButton is not a type


解决办法:

添加该QML文件到统一前缀下


当然,别的原因也可能导致该问题,如不在同一目录


0 0