herospellwidget.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * herospellwidget.h, part of VCMI engine
  3. *
  4. * Authors: listed in file AUTHORS in main folder
  5. *
  6. * License: GNU General Public License v2.0 or later
  7. * Full text of license available in license.txt file, in main folder
  8. *
  9. */
  10. #pragma once
  11. #include <QDialog>
  12. #include "baseinspectoritemdelegate.h"
  13. #include "../../lib/mapObjects/CGHeroInstance.h"
  14. namespace Ui {
  15. class HeroSpellWidget;
  16. }
  17. class HeroSpellWidget : public QDialog
  18. {
  19. Q_OBJECT
  20. public:
  21. explicit HeroSpellWidget(CGHeroInstance &, QWidget * parent = nullptr);
  22. ~HeroSpellWidget();
  23. void obtainData();
  24. void commitChanges();
  25. private slots:
  26. void on_customizeSpells_toggled(bool checked);
  27. private:
  28. Ui::HeroSpellWidget * ui;
  29. CGHeroInstance & hero;
  30. void initSpellLists();
  31. };
  32. class HeroSpellDelegate : public BaseInspectorItemDelegate
  33. {
  34. Q_OBJECT
  35. public:
  36. using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
  37. HeroSpellDelegate(CGHeroInstance &);
  38. QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex& index) const override;
  39. void setEditorData(QWidget * editor, const QModelIndex & index) const override;
  40. void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const override;
  41. void updateModelData(QAbstractItemModel * model, const QModelIndex & index) const override;
  42. private:
  43. CGHeroInstance & hero;
  44. };