[Qt-interest] Fwd: QCache accessing problem

Yuvaraj R yuvaraj at ongobiz.com
Fri Jun 5 19:32:25 CEST 2009


Hi Friends

I stored the some collection of images  in QCache ..

Here download link is used as  keys..

When i accessing the QCache table  ,it is responding the first stored image.
only..

if access images apart  from first image ,that time application is crashing

See my code..

*Getting the image from other classes and storing in QCache
*
void Widget::getimage(QString string,QPixmap image)

{

if(!image.isNull())

{

if(!imageCache.contains(string))

{

qDebug() << "image got";

QString yu = "yuvaraj";

imageCache.insert(string,&image);

qDebug() << "Hash Table size:" << imageCache.size();

}

}

}


*Accessing the images from QCache table using keys:*


void Widget::DisplayList(QLinkedList<Returnables::StatusUser*> list, QString
header)

{

Returnables::StatusUser *statusUser = NULL;

model = new QStandardItemModel(this);

for(int i=0;i<list.size();i++)

{ QStandardItem *item = new QStandardItem;

model->appendRow(item);

}

qDebug() <<" Running at second for loop";

ui->listView_2->setModel(model);

static int j = list.size();


 for(int i=0;i<j;i++)

{



 statusUser = list.takeFirst();

QString url =statusUser->user.profileImageUrl;

QString name = statusUser->user.name;

QString text = statusUser->status.text;

if(imageCache[url] == NULL)

{

QPixmap rr;

rr = *imageCache[URL];

qDebug()<<"image null0";

qDebug() << "hi hello";

Tweet *t =new Tweet(name,text,rr);

t->resize(490,90);

model->item(i)->setSizeHint(t->size());

ui->listView_2->setIndexWidget(model->item(i)->index(), t);

qDebug()<<"i Am for loop";

}

if(imageCache[url] != NULL)

{

qDebug()<<"image is not null";

QString url1 = statusUser->user.profileImageUrl;

qDebug() << imageCache.keys();

QPixmap yy;

yy = *imageCache[url];

qDebug() << "image assigned";

Tweet *t =new Tweet(name,text,yy);

t->resize(490,90);

model->item(i)->setSizeHint(t->size());

ui->listView_2->setIndexWidget(model->item(i)->index(), t);


 }

}

}


please help me to solve this issue.


Thanks

Yuvaraj R



*
*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090605/e5742c7f/attachment.html 


More information about the Qt-interest-old mailing list