MCPcopy Create free account
hub / github.com/YACReader/yacreader / mimeData

Method mimeData

YACReaderLibrary/db/reading_list_model.cpp:326–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324}
325
326QMimeData *ReadingListModel::mimeData(const QModelIndexList &indexes) const
327{
328 QLOG_DEBUG() << "mimeData requested" << indexes;
329
330 if (indexes.length() == 0) {
331 QLOG_ERROR() << "mimeData requested: indexes is empty";
332 return new QMimeData(); // TODO what happens if 0 is returned?
333 }
334
335 if (indexes.length() > 1) {
336 QLOG_DEBUG() << "mimeData requested for more than one index, this shouldn't be possible";
337 }
338
339 QModelIndex modelIndex = indexes.at(0);
340
341 QList<QPair<int, int>> rows;
342 rows << QPair<int, int>(modelIndex.row(), modelIndex.parent().row());
343 QLOG_DEBUG() << "mimeData requested for row : " << modelIndex.row();
344
345 QByteArray data;
346 QDataStream out(&data, QIODevice::WriteOnly);
347 out << rows; // serialize the list of identifiers
348
349 auto mimeData = new QMimeData();
350 mimeData->setData(YACReader::YACReaderLibrarSubReadingListMimeDataFormat, data);
351
352 return mimeData;
353}
354
355void ReadingListModel::setupReadingListsData(QString path)
356{

Callers

nothing calls this directly

Calls 3

rowMethod · 0.45
parentMethod · 0.45
setDataMethod · 0.45

Tested by

no test coverage detected