[SOLVED] Image problem loading
-
wrote on 7 Nov 2013, 11:53 last edited by
I have a strange behavior with Image source param
I have XmlListModel wich source url is generated on the fly, depending on user choice
@
XmlListModel {
id: movies_model
query: '/api/users'onStatusChanged: { if( status === XmlListModel.Error ) console.log('Error ' + errorString()); } XmlRole{ name: "id"; query: "id/string()"} XmlRole{ name: "name"; query: "name/string()"} XmlRole{ name: "logo"; query: "logo/string()"} // absolute url to server image
}
@and when source url generated
in delegate of ListView :
@
Component {
id: list_delegateImage { id: movie_logo source: logo height: 30; width: 30; }
}
ListView {
delegate: list_delegate
}
@And when model is loaded image is empty and debug has message :
MoviesListPage.qml:69:21: QML Image: Cannot open: file:///home/developer/projects/build-Patria-Desktop_Qt_5_1_1_GCC_32bit-Debug/qml/ProjectUsers/ http://localhost/app_dev.php/media/cache/thumbnail/images/users/527b7609df4c7.png
Some how when image take role name logo data, it trying merge absolute path to the qml with data from xml
Did somebody meet such problems ? Any help ?!
-
wrote on 7 Nov 2013, 14:14 last edited by
Try it like this maybe?
@
Image {
property url logoUrl: logo
source: logoUrl
height: 30;
width: 30;
}
@ -
wrote on 8 Nov 2013, 06:53 last edited by
Nope the same result (( It's strange, the debug shows that logo has only url. So it must work. But debug shows that image trying loading full path to qml + given url separted by space
-
wrote on 8 Nov 2013, 06:54 last edited by
Using Qt 5.1 release
-
wrote on 8 Nov 2013, 07:10 last edited by
Well, how about this:
@ Image{
property string url: logo
height: 30;
width: 30;
source: url.trim()
}
@
Maybe that space is part of your url string and makes trouble. -
wrote on 8 Nov 2013, 10:03 last edited by
Meeeeeeeen thx... This must be in docs !!!
It's working !! I didn't expected that the space brokes all.
-
wrote on 8 Nov 2013, 10:17 last edited by
Glad that it helped. I also wouldn't expect that space could brake it like this. I will try to add doc note to QML image.
3/7