summaryrefslogtreecommitdiff
path: root/src/dic-options/DraggableListModel.h
blob: e323def9998a365ad97634b4d247618b697f6af3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef DRAGGABLELISTMODEL_H
#define DRAGGABLELISTMODEL_H

#include <QAbstractListModel>

#include "DictionaryOptionsDialog.h"
#include "../dictionary/Dictionary.h"

class DraggableListModel : public QAbstractListModel
{
    Q_OBJECT

public:
    DraggableListModel( DictionaryOptionsDialog* aParent ):
        QAbstractListModel( aParent ), m_parent( aParent )
        {}

    Qt::ItemFlags flags(const QModelIndex &index) const;
    Qt::DropActions supportedDropActions() const;    
    QStringList mimeTypes() const;
    QMimeData * mimeData(const QModelIndexList &indexes) const;
    bool dropMimeData(const QMimeData *data, Qt::DropAction action, int row, int column, const QModelIndex &parent);
    virtual const void* dataPtr( const QModelIndex &aIndex ) const = 0;
    virtual void insertPointer(int aPos, void *aData) = 0;

signals:
    void indexesDropped(QList<QPersistentModelIndex> aIndexes);

protected:
    DictionaryOptionsDialog* m_parent;
};

#endif