| 216 | } |
| 217 | |
| 218 | QMimeData *ComicModel::mimeData(const QModelIndexList &indexes) const |
| 219 | { |
| 220 | // custom model data |
| 221 | // application/yacreader-comics-ids + list of ids in a QByteArray |
| 222 | QList<qulonglong> ids; |
| 223 | for (const auto &index : indexes) { |
| 224 | QLOG_DEBUG() << "dragging : " << index.data(IdRole).toULongLong(); |
| 225 | ids << index.data(IdRole).toULongLong(); |
| 226 | } |
| 227 | |
| 228 | QByteArray data; |
| 229 | QDataStream out(&data, QIODevice::WriteOnly); |
| 230 | out << ids; // serialize the list of identifiers |
| 231 | |
| 232 | auto mimeData = new QMimeData(); |
| 233 | mimeData->setData(YACReader::YACReaderLibrarComiscSelectionMimeDataFormat, data); |
| 234 | |
| 235 | return mimeData; |
| 236 | } |
| 237 | |
| 238 | QStringList ComicModel::mimeTypes() const |
| 239 | { |
no test coverage detected