herospellwidget.h 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 "../../lib/mapObjects/CGHeroInstance.h"
  13. namespace Ui {
  14. class HeroSpellWidget;
  15. }
  16. class HeroSpellWidget : public QDialog
  17. {
  18. Q_OBJECT
  19. public:
  20. explicit HeroSpellWidget(CGHeroInstance &, QWidget * parent = nullptr);
  21. ~HeroSpellWidget();
  22. void obtainData();
  23. void commitChanges();
  24. private slots:
  25. void on_customizeSpells_toggled(bool checked);
  26. private:
  27. Ui::HeroSpellWidget * ui;
  28. CGHeroInstance & hero;
  29. void initSpellLists();
  30. };
  31. class HeroSpellDelegate : public QStyledItemDelegate
  32. {
  33. Q_OBJECT
  34. public:
  35. using QStyledItemDelegate::QStyledItemDelegate;
  36. HeroSpellDelegate(CGHeroInstance &);
  37. QWidget * createEditor(QWidget * parent, const QStyleOptionViewItem & option, const QModelIndex& index) const override;
  38. void setEditorData(QWidget * editor, const QModelIndex & index) const override;
  39. void setModelData(QWidget * editor, QAbstractItemModel * model, const QModelIndex & index) const override;
  40. private:
  41. CGHeroInstance & hero;
  42. };