[Qt-qml] Image { pixmap } is gone :( Can't use QIcons anymore

Stephen Kelly steveire at gmail.com
Wed Jul 21 17:03:11 CEST 2010


Hello,

The pixmap property has been removed.

http://bugreports.qt.nokia.com/browse/QTBUG-11980

This came as a great surprise to us because we are using it and it is
already very late in the release cycle to be removing things like that. The
replacement

http://doc.trolltech.com/main-snapshot/qdeclarativeimageprovider.html

Does not satisfy our usecase because it assumes that all you have in qml is
a name of a pixmap you want, not the actual image.

QML also does not support QIcons, though in the model API that's what you
have for the Qt::DecorationRole. We have a simple method of putting the icon
into the qml scene:


      Image {
          id: collectionIcon
          pixmap: KDE.iconToPixmap( model.decoration, height );
          width: 48; height: 48
      }


QPixmap KDEIntegration::iconToPixmap(const QIcon& icon, int size )
{
  return icon.pixmap( size );
}

Now that that's not possible anymore.

How do we show QIcons in QML now?

All the best,

An unhappy Steve.



More information about the Qt-qml mailing list