Go to the documentation of this file.
33 #include <QDataStream>
36 using namespace Data_Structure;
55 if (role != Qt::DisplayRole)
82 if (
index.parent().isValid())
84 return Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled | defaultFlags;
94 return Qt::CopyAction;
101 types <<
"application/pointer";
107 QMimeData* mimeData =
new QMimeData();
108 QByteArray encodedData;
110 QDataStream stream(&encodedData, QIODevice::WriteOnly);
112 foreach (
const QModelIndex&
index, indexes)
119 stream << reinterpret_cast<quint64>(item.get());
120 stream << QString(
"");
125 mimeData->setData(
"application/pointer", encodedData);
131 QModelIndex topLeft =
index(0, 0);
132 QModelIndex bottomRight =
index(rowCount() - 1, columnCount() - 1);
134 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.