| 98 | } |
| 99 | |
| 100 | Qt::ItemFlags ReadingListModel::flags(const QModelIndex &index) const |
| 101 | { |
| 102 | if (!index.isValid()) |
| 103 | return { }; |
| 104 | |
| 105 | auto item = static_cast<ListItem *>(index.internalPointer()); |
| 106 | if (typeid(*item) == typeid(ReadingListSeparatorItem)) |
| 107 | return { }; |
| 108 | |
| 109 | if (typeid(*item) == typeid(ReadingListItem) && static_cast<ReadingListItem *>(item)->parent->getId() != 0) |
| 110 | return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled | Qt::ItemIsDragEnabled; // only sublists are dragable |
| 111 | |
| 112 | return Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled; |
| 113 | } |
| 114 | |
| 115 | QVariant ReadingListModel::headerData(int section, Qt::Orientation orientation, int role) const |
| 116 | { |