qt - 未找到状态和绑定资源
问题描述
在我的应用程序中,我需要跟踪按钮的状态并更改它的图标。在 Visual Studio 中一切正常,但在 buildMashine 状态下未找到资源且图标未显示,我也尝试使用 Binding,但无法正常工作。
RowLayout {
id: chatFileDeledate
property int stateFile: model.fileState
ToolButton {
id: btnFileDownload
width: 40
height: width
Rectangle {
id: rectOverlay
Image {
id: imageIcon
width: 30
height: width
anchors.centerIn: parent
fillMode: Image.Stretch
sourceSize.width: width
sourceSize.height: height
}
}
}
states: [
State {
when: stateFile == VSQmlChatTypes.NeedDownload
PropertyChanges { target: imageIcon; source: "qrc:/img/icons/file_transfer_download.svg"; }
},
State {
when: stateFile == VSQmlChatTypes.IsDownloading
PropertyChanges { target: imageIcon; source: "qrc:/img/icons/file_transfer_stop.svg"; } //process download
},
State {
when: stateFile == VSQmlChatTypes.DownloadSuccessful
PropertyChanges { target: imageIcon; source: "qrc:/img/icons/file_transfer_open.svg"; }
},
State {
when: stateFile == VSQmlChatTypes.StopDownload
PropertyChanges { target: imageIcon; source: "qrc:/img/icons/file_transfer_error.svg"; }
}
]
}
但如果我做到了
Image {
id: imageIcon
width: 30
height: width
anchors.centerIn: parent
fillMode: Image.Stretch
sourceSize.width: width
sourceSize.height: height
source: "qrc:/img/icons/file_transfer_download.svg"
}
并显示删除状态图标
解决方案
推荐阅读
- c++ - 我将如何准确地为输入的任何文本的长度加上下划线以及将每个字母大写
- math - 16 位整数的布隆过滤器概率
- file - “带有文件名但没有文件扩展名的路径”的正确术语是什么
- javascript - 异步函数后的函数
- python - AWS CDK python 捆绑包,在 requirements.txt 中具有依赖项
- python - 如何从 Discordpy 中的目录发送 GIF
- react-native - 我的基于 Expo 的 React Native 应用程序中未显示图标
- html - 换行到
- python - 使用 python 假设库生成 Pandas 数据框,其中一行依赖于另一行
- python - 在使用训练而不是拟合后创建排列变量重要性