mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-08 22:26:51 +02:00
map editor: show edited values in inspector
This commit is contained in:
@ -84,6 +84,7 @@ set(editor_HEADERS
|
||||
inspector/herospellwidget.h
|
||||
inspector/PickObjectDelegate.h
|
||||
inspector/portraitwidget.h
|
||||
inspector/baseinspectoritemdelegate.h
|
||||
resourceExtractor/ResourceConverter.h
|
||||
mapeditorroles.h
|
||||
)
|
||||
|
@ -11,6 +11,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QItemDelegate>
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
|
||||
class MapController;
|
||||
|
||||
@ -20,7 +21,7 @@ class CGObjectInstance;
|
||||
|
||||
VCMI_LIB_NAMESPACE_END
|
||||
|
||||
class PickObjectDelegate : public QItemDelegate
|
||||
class PickObjectDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
|
@ -115,7 +115,7 @@ ArmyWidget::~ArmyWidget()
|
||||
|
||||
|
||||
|
||||
ArmyDelegate::ArmyDelegate(CArmedInstance & t): army(t), QStyledItemDelegate()
|
||||
ArmyDelegate::ArmyDelegate(CArmedInstance & t): army(t), BaseInspectorItemDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
@ -141,9 +141,27 @@ void ArmyDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, cons
|
||||
if(auto * ed = qobject_cast<ArmyWidget *>(editor))
|
||||
{
|
||||
ed->commitChanges();
|
||||
updateModelData(model, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
|
||||
void ArmyDelegate::updateModelData(QAbstractItemModel * model, const QModelIndex & index) const
|
||||
{
|
||||
QStringList textList;
|
||||
for(auto i = army.stacks.begin(); i != army.stacks.end(); i++)
|
||||
{
|
||||
auto stack = i->second;
|
||||
if(stack->count != 0 && stack->getCreature() != nullptr)
|
||||
textList += QString::number(stack->count) + " " + QString::fromStdString(stack->getCreature()->getNamePluralTranslated());
|
||||
}
|
||||
|
||||
QString text = textList.join("\n");
|
||||
QMap<int, QVariant> data;
|
||||
data[Qt::DisplayRole] = QVariant(text);
|
||||
data[Qt::ToolTipRole] = QVariant(text);
|
||||
model->setItemData(index, data);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "../StdInc.h"
|
||||
#include <QDialog>
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
#include "../lib/mapObjects/CArmedInstance.h"
|
||||
|
||||
const int TOTAL_SLOTS = 7;
|
||||
@ -39,17 +40,18 @@ private:
|
||||
std::array<QComboBox*, TOTAL_SLOTS> uiSlots;
|
||||
};
|
||||
|
||||
class ArmyDelegate : public QStyledItemDelegate
|
||||
class ArmyDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
|
||||
|
||||
ArmyDelegate(CArmedInstance &);
|
||||
|
||||
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 updateModelData(QAbstractItemModel * model, const QModelIndex & index) const override;
|
||||
|
||||
private:
|
||||
CArmedInstance & army;
|
||||
|
22
mapeditor/inspector/baseinspectoritemdelegate.h
Normal file
22
mapeditor/inspector/baseinspectoritemdelegate.h
Normal file
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* baseinspectoritemdelegate.h, part of VCMI engine
|
||||
*
|
||||
* Authors: listed in file AUTHORS in main folder
|
||||
*
|
||||
* License: GNU General Public License v2.0 or later
|
||||
* Full text of license available in license.txt file, in main folder
|
||||
*
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <QStyledItemDelegate>
|
||||
#include <QAbstractItemModel>
|
||||
|
||||
class BaseInspectorItemDelegate : public QStyledItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
|
||||
virtual void updateModelData(QAbstractItemModel * model, const QModelIndex & index) const {};
|
||||
};
|
@ -110,7 +110,7 @@ void HeroArtifactsWidget::commitChanges()
|
||||
}
|
||||
}
|
||||
|
||||
HeroArtifactsDelegate::HeroArtifactsDelegate(CGHeroInstance & h) : QStyledItemDelegate(), hero(h)
|
||||
HeroArtifactsDelegate::HeroArtifactsDelegate(CGHeroInstance & h) : BaseInspectorItemDelegate(), hero(h)
|
||||
{
|
||||
}
|
||||
|
||||
@ -136,9 +136,30 @@ void HeroArtifactsDelegate::setModelData(QWidget * editor, QAbstractItemModel *
|
||||
if (auto * ed = qobject_cast<HeroArtifactsWidget *>(editor))
|
||||
{
|
||||
ed->commitChanges();
|
||||
updateModelData(model, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
|
||||
void HeroArtifactsDelegate::updateModelData(QAbstractItemModel * model, const QModelIndex & index) const
|
||||
{
|
||||
QStringList textList;
|
||||
for(const auto & [artPosition, artSlotInfo] : hero.artifactsWorn)
|
||||
{
|
||||
auto slotText = NArtifactPosition::namesHero[artPosition.num];
|
||||
textList += QString::fromStdString(slotText) + ": " + QString::fromStdString(artSlotInfo.artifact->getType()->getNameTranslated());
|
||||
}
|
||||
textList += QString::fromStdString(NArtifactPosition::backpack) + ":";
|
||||
for(const auto & art : hero.artifactsInBackpack)
|
||||
{
|
||||
textList += QString::fromStdString(art.artifact->getType()->getNameTranslated());
|
||||
}
|
||||
QString text = textList.join("\n");
|
||||
QMap<int, QVariant> data;
|
||||
data[Qt::DisplayRole] = QVariant(text);
|
||||
data[Qt::ToolTipRole] = QVariant(text);
|
||||
model->setItemData(index, data);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||
|
||||
namespace Ui {
|
||||
@ -48,17 +49,18 @@ private:
|
||||
|
||||
};
|
||||
|
||||
class HeroArtifactsDelegate : public QStyledItemDelegate
|
||||
class HeroArtifactsDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
|
||||
|
||||
HeroArtifactsDelegate(CGHeroInstance &);
|
||||
|
||||
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 updateModelData(QAbstractItemModel * model, const QModelIndex & index) const override;
|
||||
|
||||
private:
|
||||
CGHeroInstance & hero;
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "heroskillswidget.h"
|
||||
#include "ui_heroskillswidget.h"
|
||||
#include "../../lib/constants/StringConstants.h"
|
||||
#include "../../lib/entities/hero/CHeroHandler.h"
|
||||
#include "../../lib/CSkillHandler.h"
|
||||
#include "inspector.h"
|
||||
|
||||
@ -115,7 +116,7 @@ void HeroSkillsWidget::commitChanges()
|
||||
}
|
||||
}
|
||||
|
||||
HeroSkillsDelegate::HeroSkillsDelegate(CGHeroInstance & h): hero(h), QStyledItemDelegate()
|
||||
HeroSkillsDelegate::HeroSkillsDelegate(CGHeroInstance & h): hero(h), BaseInspectorItemDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
@ -141,9 +142,38 @@ void HeroSkillsDelegate::setModelData(QWidget *editor, QAbstractItemModel *model
|
||||
if(auto * ed = qobject_cast<HeroSkillsWidget *>(editor))
|
||||
{
|
||||
ed->commitChanges();
|
||||
updateModelData(model, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
|
||||
void HeroSkillsDelegate::updateModelData(QAbstractItemModel * model, const QModelIndex & index) const
|
||||
{
|
||||
QStringList textList;
|
||||
textList += QString::fromStdString(VLC->generaltexth->primarySkillNames[PrimarySkill::ATTACK]) + ": " + QString::number(hero.getBasePrimarySkillValue(PrimarySkill::ATTACK));
|
||||
textList += QString::fromStdString(VLC->generaltexth->primarySkillNames[PrimarySkill::DEFENSE]) + ": " + QString::number(hero.getBasePrimarySkillValue(PrimarySkill::DEFENSE));
|
||||
textList += QString::fromStdString(VLC->generaltexth->primarySkillNames[PrimarySkill::SPELL_POWER]) + ": " + QString::number(hero.getBasePrimarySkillValue(PrimarySkill::SPELL_POWER));
|
||||
textList += QString::fromStdString(VLC->generaltexth->primarySkillNames[PrimarySkill::KNOWLEDGE]) + ": " + QString::number(hero.getBasePrimarySkillValue(PrimarySkill::KNOWLEDGE));
|
||||
;
|
||||
auto heroSecondarySkills = hero.secSkills;
|
||||
if(heroSecondarySkills.size() == 1 && heroSecondarySkills[0].first == SecondarySkill::NONE)
|
||||
{
|
||||
textList += QObject::tr("Default secondary skills:");
|
||||
heroSecondarySkills = hero.getHeroType()->secSkillsInit;
|
||||
}
|
||||
else
|
||||
{
|
||||
textList += QObject::tr("Secondary skills:");
|
||||
}
|
||||
for(auto & [skill, skillLevel] : heroSecondarySkills)
|
||||
textList += QString::fromStdString(VLC->skillh->getById(skill)->getNameTranslated()) + " " + LevelIdentifiers[skillLevel - 1].first;
|
||||
|
||||
QString text = textList.join("\n");
|
||||
QMap<int, QVariant> data;
|
||||
data[Qt::DisplayRole] = QVariant(text);
|
||||
data[Qt::ToolTipRole] = QVariant(text);
|
||||
model->setItemData(index, data);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||
|
||||
namespace Ui {
|
||||
@ -42,17 +43,18 @@ private:
|
||||
std::set<int> occupiedSkills;
|
||||
};
|
||||
|
||||
class HeroSkillsDelegate : public QStyledItemDelegate
|
||||
class HeroSkillsDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
|
||||
|
||||
HeroSkillsDelegate(CGHeroInstance &);
|
||||
|
||||
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 updateModelData(QAbstractItemModel * model, const QModelIndex & index) const override;
|
||||
|
||||
private:
|
||||
CGHeroInstance & hero;
|
||||
|
@ -101,7 +101,7 @@ void HeroSpellWidget::on_customizeSpells_toggled(bool checked)
|
||||
initSpellLists();
|
||||
}
|
||||
|
||||
HeroSpellDelegate::HeroSpellDelegate(CGHeroInstance & h) : hero(h), QStyledItemDelegate()
|
||||
HeroSpellDelegate::HeroSpellDelegate(CGHeroInstance & h) : hero(h), BaseInspectorItemDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
@ -127,9 +127,34 @@ void HeroSpellDelegate::setModelData(QWidget * editor, QAbstractItemModel * mode
|
||||
if (auto * ed = qobject_cast<HeroSpellWidget *>(editor))
|
||||
{
|
||||
ed->commitChanges();
|
||||
updateModelData(model, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
|
||||
void HeroSpellDelegate::updateModelData(QAbstractItemModel * model, const QModelIndex & index) const
|
||||
{
|
||||
QMap<int, QVariant> data;
|
||||
if(hero.spellbookContainsSpell(SpellID::PRESET))
|
||||
{
|
||||
QStringList textList;
|
||||
textList += QObject::tr("Custom Spells:");
|
||||
for(auto const & spellID : hero.getSpellsInSpellbook())
|
||||
{
|
||||
if(spellID != SpellID::PRESET)
|
||||
textList += QString::fromStdString(spellID.toSpell()->getNameTranslated());
|
||||
}
|
||||
QString text = textList.join("\n");
|
||||
data[Qt::DisplayRole] = QVariant(text);
|
||||
data[Qt::ToolTipRole] = QVariant(text);
|
||||
}
|
||||
else
|
||||
{
|
||||
data[Qt::DisplayRole] = QObject::tr("Default Spells");
|
||||
data[Qt::ToolTipRole] = QObject::tr("Default Spells");
|
||||
}
|
||||
model->setItemData(index, data);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||
|
||||
namespace Ui {
|
||||
@ -39,17 +40,18 @@ private:
|
||||
void initSpellLists();
|
||||
};
|
||||
|
||||
class HeroSpellDelegate : public QStyledItemDelegate
|
||||
class HeroSpellDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
|
||||
|
||||
HeroSpellDelegate(CGHeroInstance &);
|
||||
|
||||
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 updateModelData(QAbstractItemModel * model, const QModelIndex & index) const override;
|
||||
|
||||
private:
|
||||
CGHeroInstance & hero;
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include "../lib/mapObjects/ObjectTemplate.h"
|
||||
#include "../lib/mapping/CMap.h"
|
||||
#include "../lib/constants/StringConstants.h"
|
||||
#include "../lib/CPlayerState.h"
|
||||
#include "../lib/texts/CGeneralTextHandler.h"
|
||||
|
||||
#include "townbuildingswidget.h"
|
||||
@ -249,7 +250,7 @@ void Inspector::updateProperties(CGDwelling * o)
|
||||
if (o->ID == Obj::RANDOM_DWELLING || o->ID == Obj::RANDOM_DWELLING_LVL)
|
||||
{
|
||||
auto * delegate = new PickObjectDelegate(controller, PickObjectDelegate::typedFilter<CGTownInstance>);
|
||||
addProperty(QObject::tr("Same as town"), PropertyEditorPlaceholder(), delegate, false);
|
||||
addProperty(QObject::tr("Same as town"), o->randomizationInfo, delegate, false);
|
||||
}
|
||||
}
|
||||
|
||||
@ -850,6 +851,7 @@ QTableWidgetItem * Inspector::addProperty(const QString & value)
|
||||
{
|
||||
auto * item = new QTableWidgetItem(value);
|
||||
item->setFlags(Qt::NoItemFlags);
|
||||
item->setToolTip(value);
|
||||
return item;
|
||||
}
|
||||
|
||||
@ -905,6 +907,17 @@ QTableWidgetItem * Inspector::addProperty(CGCreature::Character value)
|
||||
return item;
|
||||
}
|
||||
|
||||
QTableWidgetItem * Inspector::addProperty(const std::optional<CGDwellingRandomizationInfo> & value)
|
||||
{
|
||||
QString text = QObject::tr("Select town");
|
||||
if(value.has_value() && !value->instanceId.empty())
|
||||
text = QString::fromStdString(value->instanceId);
|
||||
|
||||
auto * item = new QTableWidgetItem(text);
|
||||
item->setFlags(Qt::NoItemFlags);
|
||||
return item;
|
||||
}
|
||||
|
||||
//========================================================================
|
||||
|
||||
Inspector::Inspector(MapController & c, CGObjectInstance * o, QTableWidget * t): obj(o), table(t), controller(c)
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include <QTableWidget>
|
||||
#include <QTableWidgetItem>
|
||||
#include <QStyledItemDelegate>
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
#include "../lib/int3.h"
|
||||
#include "../lib/GameConstants.h"
|
||||
#include "../lib/mapObjects/CGCreature.h"
|
||||
@ -101,6 +102,7 @@ protected:
|
||||
QTableWidgetItem * addProperty(bool value);
|
||||
QTableWidgetItem * addProperty(CGObjectInstance * value);
|
||||
QTableWidgetItem * addProperty(CGCreature::Character value);
|
||||
QTableWidgetItem * addProperty(const std::optional<CGDwellingRandomizationInfo> & value);
|
||||
QTableWidgetItem * addProperty(PropertyEditorPlaceholder value);
|
||||
|
||||
//===============END OF DECLARATION=======================================
|
||||
@ -117,7 +119,7 @@ public:
|
||||
protected:
|
||||
|
||||
template<class T>
|
||||
void addProperty(const QString & key, const T & value, QAbstractItemDelegate * delegate, bool restricted)
|
||||
void addProperty(const QString & key, const T & value, BaseInspectorItemDelegate * delegate, bool restricted)
|
||||
{
|
||||
auto * itemValue = addProperty(value);
|
||||
if(!restricted)
|
||||
@ -144,6 +146,11 @@ protected:
|
||||
++row;
|
||||
}
|
||||
itemKey->setFlags(restricted ? Qt::NoItemFlags : Qt::ItemIsEnabled);
|
||||
if(delegate != nullptr)
|
||||
{
|
||||
QModelIndex index = table->model()->index(itemValue->row(), itemValue->column());
|
||||
delegate->updateModelData(table->model(), index);
|
||||
}
|
||||
}
|
||||
|
||||
template<class T>
|
||||
@ -161,11 +168,11 @@ protected:
|
||||
};
|
||||
|
||||
|
||||
class InspectorDelegate : public QStyledItemDelegate
|
||||
class InspectorDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
|
||||
|
||||
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
|
||||
|
@ -9,6 +9,7 @@
|
||||
*/
|
||||
#pragma once
|
||||
#include "../StdInc.h"
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
#include <QDialog>
|
||||
|
||||
namespace Ui {
|
||||
@ -31,11 +32,11 @@ private:
|
||||
};
|
||||
|
||||
|
||||
class MessageDelegate : public QStyledItemDelegate
|
||||
class MessageDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
|
||||
|
||||
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
|
||||
|
@ -102,7 +102,7 @@ void PortraitWidget::on_buttonPrev_clicked()
|
||||
drawPortrait();
|
||||
}
|
||||
|
||||
PortraitDelegate::PortraitDelegate(CGHeroInstance & h): hero(h), QStyledItemDelegate()
|
||||
PortraitDelegate::PortraitDelegate(CGHeroInstance & h): hero(h), BaseInspectorItemDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
@ -128,9 +128,21 @@ void PortraitDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
|
||||
if(auto * ed = qobject_cast<PortraitWidget *>(editor))
|
||||
{
|
||||
ed->commitChanges();
|
||||
updateModelData(model, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
|
||||
void PortraitDelegate::updateModelData(QAbstractItemModel * model, const QModelIndex & index) const
|
||||
{
|
||||
QMap<int, QVariant> data;
|
||||
if(hero.customPortraitSource == HeroTypeID::NONE)
|
||||
data[Qt::DisplayRole] = QObject::tr("Default");
|
||||
else
|
||||
data[Qt::DisplayRole] = QString::fromStdString(hero.customPortraitSource.toHeroType()->getNameTranslated());
|
||||
|
||||
model->setItemData(index, data);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
#include "../../lib/mapObjects/CGHeroInstance.h"
|
||||
|
||||
namespace Ui {
|
||||
@ -47,17 +48,18 @@ private:
|
||||
int portraitIndex;
|
||||
};
|
||||
|
||||
class PortraitDelegate : public QStyledItemDelegate
|
||||
class PortraitDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
|
||||
|
||||
PortraitDelegate(CGHeroInstance &);
|
||||
|
||||
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 updateModelData(QAbstractItemModel * model, const QModelIndex & index) const override;
|
||||
|
||||
private:
|
||||
CGHeroInstance & hero;
|
||||
|
@ -391,7 +391,7 @@ void QuestWidget::on_lCreatureRemove_clicked()
|
||||
ui->lCreatures->removeRow(i);
|
||||
}
|
||||
|
||||
QuestDelegate::QuestDelegate(MapController & c, CQuest & t): controller(c), quest(t), QStyledItemDelegate()
|
||||
QuestDelegate::QuestDelegate(MapController & c, CQuest & t): controller(c), quest(t), BaseInspectorItemDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
@ -417,6 +417,7 @@ void QuestDelegate::setModelData(QWidget * editor, QAbstractItemModel * model, c
|
||||
if(auto *ed = qobject_cast<QuestWidget *>(editor))
|
||||
{
|
||||
ed->commitChanges();
|
||||
updateModelData(model, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -439,3 +440,86 @@ bool QuestDelegate::eventFilter(QObject * object, QEvent * event)
|
||||
}
|
||||
return QStyledItemDelegate::eventFilter(object, event);
|
||||
}
|
||||
|
||||
void QuestDelegate::updateModelData(QAbstractItemModel * model, const QModelIndex & index) const
|
||||
{
|
||||
QStringList textList;
|
||||
textList += QObject::tr("Quest:");
|
||||
textList += QObject::tr("Day of Week: %1").arg(quest.mission.dayOfWeek);
|
||||
textList += QObject::tr("Days Passed: %1").arg(quest.mission.daysPassed);
|
||||
textList += QObject::tr("Hero Level: %1").arg(quest.mission.heroLevel);
|
||||
textList += QObject::tr("Hero Experience: %1").arg(quest.mission.heroExperience);
|
||||
textList += QObject::tr("Mana Points: %1").arg(quest.mission.manaPoints);
|
||||
textList += QObject::tr("Mana Percentage: %1").arg(quest.mission.manaPercentage);
|
||||
textList += QObject::tr("Primary Skills: %1/%2/%3/%4").arg(quest.mission.primary[0]).arg(quest.mission.primary[1]).arg(quest.mission.primary[2]).arg(quest.mission.primary[3]);
|
||||
|
||||
QStringList resourcesList;
|
||||
for(GameResID resource = GameResID::WOOD; resource < GameResID::COUNT ; resource++)
|
||||
{
|
||||
if(resource == GameResID::MITHRIL)
|
||||
continue;
|
||||
if(quest.mission.resources[resource] == 0)
|
||||
continue;
|
||||
MetaString str;
|
||||
str.appendName(resource);
|
||||
resourcesList += QString::fromStdString(str.toString()) + ": " + QString::number(quest.mission.resources[resource]);
|
||||
}
|
||||
textList += QObject::tr("Resources: ") + resourcesList.join(", ");
|
||||
|
||||
QStringList artifactsList;
|
||||
for(auto artifact : quest.mission.artifacts)
|
||||
{
|
||||
artifactsList += QString::fromStdString(VLC->artifacts()->getById(artifact)->getNameTranslated());
|
||||
}
|
||||
textList += QObject::tr("Artifacts: ") + artifactsList.join(", ");
|
||||
|
||||
QStringList spellsList;
|
||||
for(auto spell : quest.mission.spells)
|
||||
{
|
||||
spellsList += QString::fromStdString(VLC->spells()->getById(spell)->getNameTranslated());
|
||||
}
|
||||
textList += QObject::tr("Spells: ") + spellsList.join(", ");
|
||||
|
||||
QStringList secondarySkillsList;
|
||||
for(auto & [skill, skillLevel] : quest.mission.secondary)
|
||||
{
|
||||
secondarySkillsList += QString::fromStdString(VLC->skills()->getById(skill)->getNameTranslated()) + " (" + QString::number(skillLevel) + ")";
|
||||
}
|
||||
textList += QObject::tr("Secondary Skills: ") + secondarySkillsList.join(", ");
|
||||
|
||||
QStringList creaturesList;
|
||||
for(auto & creature : quest.mission.creatures)
|
||||
{
|
||||
creaturesList += QString::number(creature.count) + " " + QString::fromStdString(creature.getType()->getNamePluralTranslated());
|
||||
}
|
||||
textList += QObject::tr("Creatures: ") + creaturesList.join(", ");
|
||||
|
||||
QStringList heroesList;
|
||||
for(auto & hero : quest.mission.heroes)
|
||||
{
|
||||
heroesList += QString::fromStdString(VLC->heroTypes()->getById(hero)->getNameTranslated());
|
||||
}
|
||||
textList += QObject::tr("Heroes: ") + heroesList.join(", ");
|
||||
|
||||
QStringList heroClassesList;
|
||||
for(auto & heroClass : quest.mission.heroClasses)
|
||||
{
|
||||
heroClassesList += QString::fromStdString(VLC->heroClasses()->getById(heroClass)->getNameTranslated());
|
||||
}
|
||||
textList += QObject::tr("Hero Classes: ") + heroClassesList.join(", ");
|
||||
|
||||
QStringList playersList;
|
||||
for(auto & player : quest.mission.players)
|
||||
{
|
||||
MetaString str;
|
||||
str.appendName(player);
|
||||
playersList += QString::fromStdString(str.toString());
|
||||
}
|
||||
textList += QObject::tr("Players: ") + playersList.join(", ");
|
||||
|
||||
QString text = textList.join("\n");
|
||||
QMap<int, QVariant> data;
|
||||
data[Qt::DisplayRole] = QVariant(text);
|
||||
data[Qt::ToolTipRole] = QVariant(text);
|
||||
model->setItemData(index, data);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#pragma once
|
||||
#include "../StdInc.h"
|
||||
#include <QDialog>
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
#include "../lib/mapObjects/CQuest.h"
|
||||
|
||||
namespace Ui {
|
||||
@ -46,17 +47,18 @@ private:
|
||||
Ui::QuestWidget *ui;
|
||||
};
|
||||
|
||||
class QuestDelegate : public QStyledItemDelegate
|
||||
class QuestDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
|
||||
|
||||
QuestDelegate(MapController &, CQuest &);
|
||||
|
||||
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 updateModelData(QAbstractItemModel * model, const QModelIndex & index) const override;
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject * object, QEvent * event) override;
|
||||
|
@ -742,6 +742,7 @@ void RewardsDelegate::setModelData(QWidget *editor, QAbstractItemModel *model, c
|
||||
if(auto * ed = qobject_cast<RewardsWidget *>(editor))
|
||||
{
|
||||
ed->commitChanges();
|
||||
updateModelData(model, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -757,3 +758,71 @@ QWidget * RewardsDelegate::createEditor(QWidget *parent, const QStyleOptionViewI
|
||||
{
|
||||
return new RewardsWidget(map, object, parent);
|
||||
}
|
||||
|
||||
void RewardsDelegate::updateModelData(QAbstractItemModel * model, const QModelIndex & index) const
|
||||
{
|
||||
QStringList textList;
|
||||
textList += QObject::tr("Rewards:");
|
||||
for (const auto & vinfo : object.configuration.info)
|
||||
{
|
||||
textList += QObject::tr("Reward Message: %1").arg(QString::fromStdString(vinfo.message.toString()));
|
||||
textList += QObject::tr("Hero Level: %1").arg(vinfo.reward.heroLevel);
|
||||
textList += QObject::tr("Hero Experience: %1").arg(vinfo.reward.heroExperience);
|
||||
textList += QObject::tr("Mana Diff: %1").arg(vinfo.reward.manaDiff);
|
||||
textList += QObject::tr("Mana Percentage: %1").arg(vinfo.reward.manaPercentage);
|
||||
textList += QObject::tr("Move Points: %1").arg(vinfo.reward.movePoints);
|
||||
textList += QObject::tr("Move Percentage: %1").arg(vinfo.reward.movePercentage);
|
||||
textList += QObject::tr("Primary Skills: %1/%2/%3/%4").arg(vinfo.reward.primary[0]).arg(vinfo.reward.primary[1]).arg(vinfo.reward.primary[2]).arg(vinfo.reward.primary[3]);
|
||||
QStringList resourcesList;
|
||||
for(GameResID resource = GameResID::WOOD; resource < GameResID::COUNT ; resource++)
|
||||
{
|
||||
if(resource == GameResID::MITHRIL)
|
||||
continue; // translated as "Abandoned"?
|
||||
if(vinfo.reward.resources[resource] == 0)
|
||||
continue;
|
||||
MetaString str;
|
||||
str.appendName(resource);
|
||||
resourcesList += QString::fromStdString(str.toString()) + ": " + QString::number(vinfo.reward.resources[resource]);
|
||||
}
|
||||
textList += QObject::tr("Resources: ") + resourcesList.join(", ");
|
||||
QStringList artifactsList;
|
||||
for (auto artifact : vinfo.reward.artifacts)
|
||||
{
|
||||
artifactsList += QString::fromStdString(VLC->artifacts()->getById(artifact)->getNameTranslated());
|
||||
}
|
||||
textList += QObject::tr("Artifacts: ") + artifactsList.join(", ");
|
||||
QStringList spellsList;
|
||||
for (auto spell : vinfo.reward.spells)
|
||||
{
|
||||
spellsList += QString::fromStdString(VLC->spells()->getById(spell)->getNameTranslated());
|
||||
}
|
||||
textList += QObject::tr("Spells: ") + spellsList.join(", ");
|
||||
QStringList secondarySkillsList;
|
||||
for(auto & [skill, skillLevel] : vinfo.reward.secondary)
|
||||
{
|
||||
secondarySkillsList += QString::fromStdString(VLC->skills()->getById(skill)->getNameTranslated()) + " (" + QString::number(skillLevel) + ")";
|
||||
}
|
||||
textList += QObject::tr("Secondary Skills: ") + secondarySkillsList.join(", ");
|
||||
QStringList creaturesList;
|
||||
for (auto & creature : vinfo.reward.creatures)
|
||||
{
|
||||
creaturesList += QString::number(creature.count) + " " + QString::fromStdString(creature.getType()->getNamePluralTranslated());
|
||||
}
|
||||
textList += QObject::tr("Creatures: ") + creaturesList.join(", ");
|
||||
if (vinfo.reward.spellCast.first != SpellID::NONE)
|
||||
{
|
||||
textList += QObject::tr("Spell Cast: ") + QString::fromStdString(VLC->spells()->getById(vinfo.reward.spellCast.first)->getNameTranslated()) + " (" + QString::number(vinfo.reward.spellCast.second) + ")";
|
||||
}
|
||||
QStringList bonusesList;
|
||||
for (auto & bonus : vinfo.reward.bonuses)
|
||||
{
|
||||
bonusesList += QString::fromStdString(vstd::findKey(bonusDurationMap, bonus.duration)) + " " + QString::fromStdString(vstd::findKey(bonusNameMap, bonus.type)) + " (" + QString::number(bonus.val) + ")";
|
||||
}
|
||||
textList += QObject::tr("Bonuses: ") + bonusesList.join(", ");
|
||||
}
|
||||
QString text = textList.join("\n");
|
||||
QMap<int, QVariant> data;
|
||||
data[Qt::DisplayRole] = QVariant(text);
|
||||
data[Qt::ToolTipRole] = QVariant(text);
|
||||
model->setItemData(index, data);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#pragma once
|
||||
#include "../StdInc.h"
|
||||
#include <QDialog>
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
#include "../lib/mapObjects/CRewardableObject.h"
|
||||
|
||||
namespace Ui {
|
||||
@ -67,18 +68,19 @@ private:
|
||||
CMap & map;
|
||||
};
|
||||
|
||||
class RewardsDelegate : public QStyledItemDelegate
|
||||
class RewardsDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
RewardsDelegate(CMap &, CRewardableObject &);
|
||||
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
|
||||
|
||||
void setEditorData(QWidget *editor, const QModelIndex &index) const override;
|
||||
void setModelData(QWidget *editor, QAbstractItemModel *model, const QModelIndex &index) const override;
|
||||
|
||||
QWidget * createEditor(QWidget *parent, const QStyleOptionViewItem &option, const QModelIndex &index) const override;
|
||||
void updateModelData(QAbstractItemModel * model, const QModelIndex & index) const override;
|
||||
|
||||
private:
|
||||
CRewardableObject & object;
|
||||
|
@ -318,7 +318,7 @@ void TownBuildingsWidget::onItemChanged(const QStandardItem * item) {
|
||||
connect(&model, &QStandardItemModel::itemChanged, this, &TownBuildingsWidget::onItemChanged);
|
||||
}
|
||||
|
||||
TownBuildingsDelegate::TownBuildingsDelegate(CGTownInstance & t): town(t), QStyledItemDelegate()
|
||||
TownBuildingsDelegate::TownBuildingsDelegate(CGTownInstance & t): town(t), BaseInspectorItemDelegate()
|
||||
{
|
||||
}
|
||||
|
||||
@ -353,6 +353,7 @@ void TownBuildingsDelegate::setModelData(QWidget *editor, QAbstractItemModel *mo
|
||||
town.removeAllBuildings();
|
||||
for(const auto & building : ed->getBuiltBuildings())
|
||||
town.addBuilding(building);
|
||||
updateModelData(model, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -360,4 +361,33 @@ void TownBuildingsDelegate::setModelData(QWidget *editor, QAbstractItemModel *mo
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void TownBuildingsDelegate::updateModelData(QAbstractItemModel * model, const QModelIndex & index) const
|
||||
{
|
||||
QStringList textList;
|
||||
textList += QObject::tr("Built buildings:");
|
||||
auto * ctown = town.getTown();
|
||||
if(!ctown)
|
||||
ctown = VLC->townh->randomTown;
|
||||
for(const auto & buildingID : town.getBuildings())
|
||||
{
|
||||
if(buildingID == BuildingID::DEFAULT)
|
||||
continue;
|
||||
auto name = QString::fromStdString(ctown->buildings.at(buildingID)->getNameTranslated());
|
||||
if(name.isEmpty())
|
||||
name = QString::fromStdString(defaultBuildingIdConversion(buildingID));
|
||||
textList += name;
|
||||
}
|
||||
textList += QObject::tr("Forbidden buildings:");
|
||||
for(const auto & buildingID : town.forbiddenBuildings)
|
||||
{
|
||||
auto name = QString::fromStdString(ctown->buildings.at(buildingID)->getNameTranslated());
|
||||
if(name.isEmpty())
|
||||
name = QString::fromStdString(defaultBuildingIdConversion(buildingID));
|
||||
textList += name;
|
||||
}
|
||||
QString text = textList.join("\n");
|
||||
QMap<int, QVariant> data;
|
||||
data[Qt::DisplayRole] = QVariant(text);
|
||||
data[Qt::ToolTipRole] = QVariant(text);
|
||||
model->setItemData(index, data);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "../StdInc.h"
|
||||
#include <QDialog>
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
#include "../lib/mapObjects/CGTownInstance.h"
|
||||
|
||||
namespace Ui {
|
||||
@ -66,17 +67,18 @@ private:
|
||||
mutable QStandardItemModel model;
|
||||
};
|
||||
|
||||
class TownBuildingsDelegate : public QStyledItemDelegate
|
||||
class TownBuildingsDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
|
||||
|
||||
TownBuildingsDelegate(CGTownInstance &);
|
||||
|
||||
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 updateModelData(QAbstractItemModel * model, const QModelIndex & index) const override;
|
||||
|
||||
private:
|
||||
CGTownInstance & town;
|
||||
|
@ -143,7 +143,7 @@ void TownEventsWidget::on_eventsList_itemActivated(QListWidgetItem* item)
|
||||
}
|
||||
|
||||
|
||||
TownEventsDelegate::TownEventsDelegate(CGTownInstance & town, MapController & c) : QStyledItemDelegate(), town(town), controller(c)
|
||||
TownEventsDelegate::TownEventsDelegate(CGTownInstance & town, MapController & c) : BaseInspectorItemDelegate(), town(town), controller(c)
|
||||
{
|
||||
}
|
||||
|
||||
@ -169,9 +169,25 @@ void TownEventsDelegate::setModelData(QWidget * editor, QAbstractItemModel * mod
|
||||
if (auto * ed = qobject_cast<TownEventsWidget *>(editor))
|
||||
{
|
||||
ed->commitChanges(controller);
|
||||
updateModelData(model, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
|
||||
void TownEventsDelegate::updateModelData(QAbstractItemModel * model, const QModelIndex & index) const
|
||||
{
|
||||
QStringList eventLists;
|
||||
for (const auto & event : town.events)
|
||||
{
|
||||
auto eventName = QString::fromStdString(event.name);
|
||||
eventLists += tr("Day %1 - %2").arg(event.firstOccurrence + 1, 3).arg(eventName);
|
||||
}
|
||||
QString text = QObject::tr("Town Events:\n") + eventLists.join(",\n");
|
||||
QMap<int, QVariant> data;
|
||||
data[Qt::DisplayRole] = QVariant(text);
|
||||
data[Qt::ToolTipRole] = QVariant(text);
|
||||
model->setItemData(index, data);
|
||||
}
|
||||
|
@ -11,6 +11,7 @@
|
||||
|
||||
#include "../StdInc.h"
|
||||
#include <QDialog>
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
#include "../lib/mapping/CMapDefines.h"
|
||||
#include "../lib/mapObjects/CGTownInstance.h"
|
||||
#include "../mapcontroller.h"
|
||||
@ -40,17 +41,18 @@ private:
|
||||
CGTownInstance & town;
|
||||
};
|
||||
|
||||
class TownEventsDelegate : public QStyledItemDelegate
|
||||
class TownEventsDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
|
||||
|
||||
TownEventsDelegate(CGTownInstance &, MapController &);
|
||||
|
||||
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 updateModelData(QAbstractItemModel * model, const QModelIndex & index) const override;
|
||||
|
||||
private:
|
||||
CGTownInstance & town;
|
||||
|
@ -132,7 +132,7 @@ void TownSpellsWidget::on_customizeSpells_toggled(bool checked)
|
||||
initSpellLists();
|
||||
}
|
||||
|
||||
TownSpellsDelegate::TownSpellsDelegate(CGTownInstance & town) : QStyledItemDelegate(), town(town)
|
||||
TownSpellsDelegate::TownSpellsDelegate(CGTownInstance & town) : BaseInspectorItemDelegate(), town(town)
|
||||
{
|
||||
}
|
||||
|
||||
@ -158,9 +158,46 @@ void TownSpellsDelegate::setModelData(QWidget * editor, QAbstractItemModel * mod
|
||||
if (auto * ed = qobject_cast<TownSpellsWidget *>(editor))
|
||||
{
|
||||
ed->commitChanges();
|
||||
updateModelData(model, index);
|
||||
}
|
||||
else
|
||||
{
|
||||
QStyledItemDelegate::setModelData(editor, model, index);
|
||||
}
|
||||
}
|
||||
|
||||
void TownSpellsDelegate::updateModelData(QAbstractItemModel * model, const QModelIndex & index) const
|
||||
{
|
||||
QStringList textList;
|
||||
QStringList requiredSpellsList;
|
||||
QStringList possibleSpellsList;
|
||||
if(vstd::contains(town.possibleSpells, SpellID::PRESET)) {
|
||||
textList += QObject::tr("Custom Spells:");
|
||||
textList += QObject::tr("Required:");
|
||||
QStringList requiredSpellsList;
|
||||
for(auto spellID : town.obligatorySpells)
|
||||
{
|
||||
auto spell = spellID.toEntity(VLC);
|
||||
requiredSpellsList += QString::fromStdString(spell->getNameTranslated());
|
||||
}
|
||||
textList += requiredSpellsList.join(",");
|
||||
textList += QObject::tr("Possible:");
|
||||
for(auto spellID : town.possibleSpells)
|
||||
{
|
||||
if(spellID == SpellID::PRESET)
|
||||
continue;
|
||||
auto spell = spellID.toEntity(VLC);
|
||||
possibleSpellsList += QString::fromStdString(spell->getNameTranslated());
|
||||
}
|
||||
textList += possibleSpellsList.join(",");
|
||||
}
|
||||
else
|
||||
{
|
||||
textList += QObject::tr("Default Spells");
|
||||
}
|
||||
QString text = textList.join("\n");
|
||||
QMap<int, QVariant> data;
|
||||
data[Qt::DisplayRole] = QVariant(text);
|
||||
data[Qt::ToolTipRole] = QVariant(text);
|
||||
model->setItemData(index, data);
|
||||
}
|
||||
|
@ -10,6 +10,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
#include "baseinspectoritemdelegate.h"
|
||||
#include "../../lib/mapObjects/CGTownInstance.h"
|
||||
|
||||
namespace Ui {
|
||||
@ -43,17 +44,18 @@ private:
|
||||
void initSpellLists();
|
||||
};
|
||||
|
||||
class TownSpellsDelegate : public QStyledItemDelegate
|
||||
class TownSpellsDelegate : public BaseInspectorItemDelegate
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
using QStyledItemDelegate::QStyledItemDelegate;
|
||||
using BaseInspectorItemDelegate::BaseInspectorItemDelegate;
|
||||
|
||||
TownSpellsDelegate(CGTownInstance&);
|
||||
|
||||
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 updateModelData(QAbstractItemModel * model, const QModelIndex & index) const override;
|
||||
|
||||
private:
|
||||
CGTownInstance& town;
|
||||
|
Reference in New Issue
Block a user