// // Created by bbr on 22.05.22.. // #include "library_list.h" #include #include #include namespace display { LibraryList::LibraryList(QWidget *parent) : QListWidget(parent) { setDragDropMode(DragOnly); } QMimeData *LibraryList::mimeData(const QList items) const { for (auto qItem: items) { // we only allow one item to be dragged at a time auto item = dynamic_cast(qItem); auto *md = new QMimeData(); md->setData(QString::fromStdString(item->mimeType), QByteArray::fromStdString(item->value)); return md; } return nullptr; } LibraryListItem::LibraryListItem(std::string title, std::string mimeType, std::string value, QListWidget *parent) : QListWidgetItem(parent), mimeType(mimeType), value(value) { setText(QString::fromStdString(title)); } } // display