1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-12 10:03:53 +02:00
vcmi/mapeditor/inspector/questwidget.h

68 lines
1.5 KiB
C++
Raw Normal View History

2022-10-16 23:16:27 +02:00
/*
* questwidget.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 "../StdInc.h"
#include <QDialog>
#include "../lib/mapObjects/CQuest.h"
namespace Ui {
class QuestWidget;
}
2023-10-09 15:54:14 +02:00
class MapController;
2022-10-16 23:16:27 +02:00
class QuestWidget : public QDialog
{
Q_OBJECT
public:
2023-10-09 15:54:14 +02:00
explicit QuestWidget(MapController &, CQuest &, QWidget *parent = nullptr);
2022-10-16 23:16:27 +02:00
~QuestWidget();
void obtainData();
2023-10-09 15:54:14 +02:00
bool commitChanges();
private slots:
void onTargetPicked(const CGObjectInstance *);
void on_lKillTargetSelect_clicked();
void on_lCreatureAdd_clicked();
void on_lCreatureRemove_clicked();
2022-10-16 23:16:27 +02:00
private:
2023-10-09 15:54:14 +02:00
void onCreatureAdd(QTableWidget * listWidget, QComboBox * comboWidget, QSpinBox * spinWidget);
CQuest & quest;
MapController & controller;
2022-10-16 23:16:27 +02:00
Ui::QuestWidget *ui;
};
class QuestDelegate : public QStyledItemDelegate
{
Q_OBJECT
public:
using QStyledItemDelegate::QStyledItemDelegate;
2023-10-09 15:54:14 +02:00
QuestDelegate(MapController &, CQuest &);
2022-10-16 23:16:27 +02:00
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;
2023-10-09 15:54:14 +02:00
protected:
bool eventFilter(QObject * object, QEvent * event) override;
2022-10-16 23:16:27 +02:00
private:
2023-10-09 15:54:14 +02:00
CQuest & quest;
MapController & controller;
2022-10-16 23:16:27 +02:00
};