From fc29354d86e6a8b5601e92405b89a1da27406ce7 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 27 Jul 2024 13:39:32 +0200 Subject: WIP --- src/filelist.h | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-) (limited to 'src/filelist.h') 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 #include #include +#include +#include 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; +}; -- cgit v1.2.3