PDA

View Full Version : QPixmap from QVairant



Talei
3rd April 2010, 15:35
Hello,
I have QStandardItemModel with QPixmap on first column. I want scale pixmaps but I can't figure out how to copy them back to tmp pixmaps.


QPixmap tmp = QPixmap( model.data( model.index( i, 0 ), Qt::DecorationRole ).toByteArray() );
//tmp is empty
//at index i,0 are Pixmaps

Any suggestion are more then welcome.

EDIT:

qDebug() << model.data( model.index( i, 0 ), Qt::DecorationRole ).type();
//out: QVariant::QPixmap

Lykurg
3rd April 2010, 16:51
Hi,
use
QPixmap tmp = model.data( model.index( i, 0 ), Qt::DecorationRole ).value<QPixmap>();

Lykurg

Talei
3rd April 2010, 17:02
Thank you. I had value<QPixmap>; without () that's why error... eh.