#ifndef FIELDSLISTMODEL_H #define FIELDSLISTMODEL_H #include #include "DictionaryOptionsDialog.h" #include "../dictionary/Dictionary.h" class FieldsListModel : public QAbstractTableModel { Q_OBJECT public: enum { EStyleRole = Qt::UserRole }; FieldsListModel( DictionaryOptionsDialog* aParent ): QAbstractTableModel( aParent ), m_parent( aParent ) {} int rowCount( const QModelIndex& /*parent*/ = QModelIndex() ) const { return m_parent->m_dict.fieldsNum(); } int columnCount( const QModelIndex& /*parent*/ = QModelIndex() ) const { return 2; } QVariant data( const QModelIndex &index, int role = Qt::DisplayRole ) const; Qt::ItemFlags flags(const QModelIndex &index) const; bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole); bool insertRows(int position, int rows, const QModelIndex &/*parent*/); bool removeRows(int position, int rows, const QModelIndex &/*parent*/); void insertField(int aPos, Field *aField); void removeField( int aPos ); 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); QVariant headerData(int section, Qt::Orientation orientation, int role) const; void moveIndexesUpDown(QModelIndexList aIndexes, int aDirection); signals: void indexesDropped(QList aIndexes); private: DictionaryOptionsDialog* m_parent; }; #endif // FIELDSLISTMODEL_H