в моем приложении мне нужно отследить состояние кнопки и изменить ее значок. В 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"
}
и значок удаления состояний будет отображаться