SpinBoxDelegate.h 827 B

12345678910111213141516171819202122232425262728
  1. #ifndef SPINBOXDELEGATE_H
  2. #define SPINBOXDELEGATE_H
  3. #include <QList>
  4. #include <qstyleditemdelegate.h>
  5. class SpinBoxDelegate : public QStyledItemDelegate
  6. {
  7. Q_OBJECT
  8. private:
  9. QStringList list;
  10. public:
  11. SpinBoxDelegate(QObject *parent = nullptr);
  12. QWidget *createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
  13. void setEditorData(QWidget *editor, const QModelIndex &index) const override;
  14. void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
  15. void updateEditorGeometry(QWidget *editor, const QStyleOptionViewItem &option,
  16. const QModelIndex &index) const override;
  17. signals:
  18. void dataChanged(const QModelIndex &index) const;
  19. };
  20. #endif // SPINBOXDELEGATE_H