QVariant Library::data(const QModelIndex &index, int role) const
{
+ TRACE;
+
+ QVariant ret;
if (!index.isValid()) {
- return QVariant();
+ return ret;
}
switch (role) {
case Qt::DisplayRole:
- return mBooks[index.row()]->name();
+ qDebug() << mBooks[index.row()]->name();
+ ret = mBooks[index.row()]->name();
+ break;
case Qt::DecorationRole:
- return QPixmap::fromImage(mBooks[index.row()]->cover);
+ qDebug() << "(cover)";
+ ret.setValue(mBooks[index.row()]->cover);
+ break;
default:
- return QVariant();
+ ;
}
+
+ return ret;
}
Book *Library::book(const QModelIndex &index)