PDA

View Full Version : loading pictures from a server



anafor2004
21st August 2009, 15:20
Dear all ,
I want draw images on screen, but images on server and there is a ethernet connection between, server and client.I tried to u http client program to take pictures but i couldnt achieve this. What do you suggest me ?

bunjee
22nd August 2009, 20:36
Take a look at : QNetworkAccessManager

Try something like that:


QNetworkAccessManager * manager;
QNetworkReply * reply = manager->get(QNetworkRequest(yourFile->url()));

anafor2004
24th August 2009, 09:36
Dear Friend,
I have install my linux, http_fetcher program, and it have a function http_fetch(),
it loads the file to memory from the server, so i could load the picture to memory, and the last step I tried to paint them to the label. But Qpixmap::loadFromData( ) didnt work. Do you have any suggestion?



char *data = NULL;
http_fetch(urlpath,&data)
pixmap.loadFromData((const uchar *)data,sizeof(data));

yogeshgokul
24th August 2009, 09:43
It seems like this fetch is a blocking function.
Please check the return value of loadFromData().
And check the length of image data after fetch to make sure that fetcher is fetching right. ;)

numbat
25th August 2009, 10:15
sizeof(data) will always return the size of a pointer. You need to use the return value of http_fetch:


int len = http_fetch(urlpath,&data)
pixmap.loadFromData((const uchar *)data, len);

On another note, using a blocking function in your GUI thread is probably not a good idea.