diff options
Diffstat (limited to 'src/filelist.h')
-rw-r--r-- | src/filelist.h | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/src/filelist.h b/src/filelist.h index 165af83..af0d40a 100644 --- a/src/filelist.h +++ b/src/filelist.h @@ -29,9 +29,41 @@ #include <QTreeView> #include <QAction> #include <QMenu> +#include <QStyledItemDelegate> +#include <QAbstractItemModel> class Instrument; -class FileDataModel; +class FileList; + +class FileDataModel + : public QAbstractItemModel +{ + Q_OBJECT +public: + FileDataModel(Instrument& instrument, FileList* fileList); + + QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override; + QModelIndex parent(const QModelIndex &index) const override; + + int rowCount(const QModelIndex &parent = QModelIndex()) const override; + + int columnCount(const QModelIndex &parent = QModelIndex()) const override; + + QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override; + + QVariant headerData(int section, Qt::Orientation orientation, int role) const override; + + Qt::ItemFlags flags(const QModelIndex &index) const override; + + bool setData(const QModelIndex &index, const QVariant &value, + int role = Qt::EditRole) override; + + void refresh(); + +private: + Instrument& instrument; + FileList* fileList; +}; class FileList : public QTreeView @@ -44,6 +76,7 @@ public: signals: void masterFileChanged(QString filename); + void positionFilesChanged(); // void fileAdded(QString file, QString name); void fileRemoved(QString file, QString name); void allFilesRemoved(); @@ -83,3 +116,26 @@ private: Instrument& instrument; FileDataModel* model; }; + +class ChannelMapDeligate + : public QStyledItemDelegate +{ + Q_OBJECT +public: + ChannelMapDeligate(Instrument& instrument, FileList* fileList); + + QWidget* createEditor(QWidget *parent, const QStyleOptionViewItem &option, + const QModelIndex &index) const override; + + void setEditorData(QWidget *editor, const QModelIndex &index) const override; + + void setModelData(QWidget *editor, QAbstractItemModel *model, + const QModelIndex &index) const override; + + void paint(QPainter* painter, const QStyleOptionViewItem& option, + const QModelIndex& index) const override; + +private: + Instrument& instrument; + FileList* fileList; +}; |