EXDataViewDelegate.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef EXDATAVIEWDELEGATE_H
  2. #define EXDATAVIEWDELEGATE_H
  3. #include <QDialog>
  4. #include <QStyledItemDelegate>
  5. class QAbstractButton;
  6. class SchemeBar : public QDialog
  7. {
  8. Q_OBJECT
  9. public:
  10. SchemeBar(const QString &lLabel, const QString &rLabel, const QStringList &vlist, QWidget *parent = nullptr);
  11. private slots:
  12. void barClicked(QAbstractButton *btn);
  13. signals:
  14. void setValue(QString val);
  15. private:
  16. QString leftLabel;
  17. QString rightLabel;
  18. QStringList barValueList;
  19. };
  20. class EXDataTableComboDelegate : public QStyledItemDelegate
  21. {
  22. public:
  23. explicit EXDataTableComboDelegate(QObject *parent = nullptr);
  24. QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
  25. void setEditorData(QWidget *editor, const QModelIndex &index) const override;
  26. void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
  27. void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
  28. const QModelIndex &index) const override;
  29. private:
  30. QStringList m_items;
  31. };
  32. #endif // EXDATAVIEWDELEGATE_H