我正在尝试从本地目录导入qml-material
。标准导入行import "/path/to/the/material/folder/" as Material
不起作用。 Material
命名空间具有RaisedButton
类型,当我像Material.RaisedButton { ... }
一样使用它时,它会给出错误,如标题中所述。
完整的QML文档:
import "/home/imran/Downloads/material-master/qml/material/" as Material
ApplicationWindow {
id: root
title: qsTr("Hello World")
width: 1080
height: 1920
color: "#ffffff"
visible: true
Material.RaisedButton {
id: materialButton
anchors.horizontalCenter: parent.horizontalCenter
text: 'Material D'
}
}
完整日志:
W/Qt (20508): (null):0 ((null)): QQmlApplicationEngine failed to load component
W/Qt (20508): (null):0 ((null)): qrc:/main.qml:43 Type Material.RaisedButton unavailable
W/Qt (20508): /home/imran/Downloads/material-master/qml/material/RaisedButton.qml:-1 Network error
W/Qt (20508):