ListWindow starts working again.
[dorian] / model / library.cpp
index c3e16e9..144d9e5 100644 (file)
@@ -37,18 +37,27 @@ int Library::rowCount(const QModelIndex &parent) const
 
 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)