Go to the documentation of this file.
29 #include <QDataStream>
37 using namespace Data_Structure;
54 return QVariant::fromValue(
58 if (role != Qt::DisplayRole)
86 if (
index.parent().isValid())
88 return Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags;
99 return Qt::CopyAction;
106 types <<
"application/pointer";
113 QMimeData* mimeData =
new QMimeData();
114 QByteArray encodedData;
116 QDataStream stream(&encodedData, QIODevice::WriteOnly);
118 foreach (
const QModelIndex&
index, indexes)
126 stream << reinterpret_cast<quint64>(item.get());
127 stream << QString(
"");
132 mimeData->setData(
"application/pointer", encodedData);
139 QModelIndex topLeft =
index(0, 0);
140 QModelIndex bottomRight =
index(rowCount() - 1, columnCount() - 1);
142 emit dataChanged(topLeft, bottomRight);
ApplicationDatabaseModel()
Constructor that sets up the first item contained by this model.
std::shared_ptr< Application > ApplicationPtr
virtual QVariant data(int column) const
QStringList mimeTypes() const override
Returns supported MIME-types.
Qt::ItemFlags flags(const QModelIndex &index) const override
This class represents an item in the ApplicationDatabaseView.
ApplicationDatabaseItem * getRootItem()
void update()
Updates the model.
void clear() override
Clears and resets this model as if it was newly constructed.
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns the behavioural flags of the object at the specified index.
QMimeData * mimeData(const QModelIndexList &indexes) const override
Returns the mimedata of the objects at the specified indexes.
QVariant data(const QModelIndex &index, int role) const override
Returns the data at the specified index, depending on the specified role.
Qt::DropActions supportedDragActions() const override
Returns the supported drag action.