harish
13th December 2011, 06:27
Hi,
I had tried to parse the image from the server.This is my coding:
QPixmap *pix;
void Homescreen::content(QList<QString> name,QList<QString> category,QList<QString> image)
{
QListWidget *listWidget = new QListWidget(0);
QStringList strList;
for(int i=0 ; i<name.count(); i++)
{
QString Name = name[i];
QString Image = image[i];
strList << Name ;
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
connect(manager,SIGNAL(finished(QNetworkReply*)),t his,SLOT(replyFinished(QNetworkReply*)));
manager->get(QNetworkRequest(Image));
QPixmap pi = new QPixmap(*pix);
ui->listWidget->addItem(new QListWidgetItem(QIcon(pi),Name,ui->listWidget));
void Homescreen::replyFinished(QNetworkReply *reply)
{
QImageReader imageReader(reply);
myImage= imageReader.read();
*pix = QPixmap::fromImage(myImage);
}
I had written the code to get the image from the server.Then i had converted the image using QPixmap to show it in the listwidget.
Now the problem is,the image is in a pointer and i need to convert the pointer value using QPixmap so that i can add it to the QListwidget.
Can anyone tell me what i need to do so that my pointer value gets converted into QPixmap.
From my code,it is showing that the painter is not active.
Thanks in advance,
Harish.M
I had tried to parse the image from the server.This is my coding:
QPixmap *pix;
void Homescreen::content(QList<QString> name,QList<QString> category,QList<QString> image)
{
QListWidget *listWidget = new QListWidget(0);
QStringList strList;
for(int i=0 ; i<name.count(); i++)
{
QString Name = name[i];
QString Image = image[i];
strList << Name ;
QNetworkAccessManager *manager = new QNetworkAccessManager(this);
connect(manager,SIGNAL(finished(QNetworkReply*)),t his,SLOT(replyFinished(QNetworkReply*)));
manager->get(QNetworkRequest(Image));
QPixmap pi = new QPixmap(*pix);
ui->listWidget->addItem(new QListWidgetItem(QIcon(pi),Name,ui->listWidget));
void Homescreen::replyFinished(QNetworkReply *reply)
{
QImageReader imageReader(reply);
myImage= imageReader.read();
*pix = QPixmap::fromImage(myImage);
}
I had written the code to get the image from the server.Then i had converted the image using QPixmap to show it in the listwidget.
Now the problem is,the image is in a pointer and i need to convert the pointer value using QPixmap so that i can add it to the QListwidget.
Can anyone tell me what i need to do so that my pointer value gets converted into QPixmap.
From my code,it is showing that the painter is not active.
Thanks in advance,
Harish.M