On Fri, Jul 23, 2010 at 4:48 AM, <[email protected]> wrote: > Hi Steve, > > On 22/07/2010, at 1:03 AM, ext Stephen Kelly wrote: > >> 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. > > > How does your model assign the QIcon for each pixmap? If it is loaded from a > file name, or has some other identifying name, you can add a new role for the > model (e.g. "imageSource") and then assign this name as a value, with a > prefix as necessary according to your custom image provider's name (e.g. > "image://myimageprovider/the_icon_name"). Add the new role using > QAbstractItemModel::setRoleNames(), and then in your QML you can replace
Yes, we identified this as a workaround too. I will likely add a DecorationNameRole returning "the_icon_name" so that I don't have qml urls in non-qml code and then use source : "pixmap://kicon/" + model.decorationName. The documentation will need to be updated too at least. http://doc.trolltech.com/main-snapshot/qdeclarativemodels.html#qabstractitemmodel says that model.decoration can be used for the decoration. However, models should return a QIcon QPixmap or QBrush for the decoration role. http://doc.trolltech.com/latest/qt.html#ItemDataRole-enum Also, please send an email to this list about the coming of API removals or changes after some point in the release cycle (after the first beta, second beta - whatever). Having advanced notice of this stuff would make it far less surprising and annoying when I git pull and the app does not start anymore. Thanks, Steve. > >> Image { >> id: collectionIcon >> pixmap: KDE.iconToPixmap( model.decoration, height ); >> width: 48; height: 48 >> } > > with > > Image { > ... > source: imageSource > } > > > The relevant part of the imageSource string (e.g. "my_icon_name") will be > passed to your QDeclarativeImageProvider::requestPixmap() method as the "id" > string, so the requestPixmap() implementation can create a QIcon and return a > pixmap using KDE.iconToPixmap() as before (or perhaps just load the pixmap > without QIcon). > > The provider can be registered with the QML engine that provides your view > e.g. if using QDeclarativeView: > > view.engine()->addImageProvider("myimageprovider", new > KDEIntegrationImageProvider); > > > regards, > > Bea > > _______________________________________________ Qt-qml mailing list [email protected] http://lists.trolltech.com/mailman/listinfo/qt-qml
