Better type conversion custom event attributes

This commit is contained in:
GriffinR
2022-10-18 19:52:35 -04:00
parent 8e6585bbb2
commit 4c3a508534
7 changed files with 160 additions and 167 deletions

View File

@@ -151,8 +151,8 @@ public:
virtual QSet<QString> getExpectedFields() = 0;
void readCustomValues(QJsonObject values);
void addCustomValuesTo(OrderedJson::object *obj);
QMap<QString, QString> getCustomValues() { return this->customValues; }
void setCustomValues(QMap<QString, QString> newCustomValues) { this->customValues = newCustomValues; }
const QMap<QString, QJsonValue> getCustomValues() { return this->customValues; }
void setCustomValues(const QMap<QString, QJsonValue> newCustomValues) { this->customValues = newCustomValues; }
virtual void loadPixmap(Project *project) = 0;
@@ -193,7 +193,7 @@ protected:
int spriteHeight = 16;
bool usingSprite = false;
QMap<QString, QString> customValues;
QMap<QString, QJsonValue> customValues;
QPixmap pixmap;
DraggablePixmapItem *pixmapItem = nullptr;

View File

@@ -12,11 +12,15 @@ public:
explicit CustomAttributesTable(Event *event, QWidget *parent = nullptr);
~CustomAttributesTable();
static const QMap<QString, QJsonValue> getAttributes(QTableWidget * table);
static QJsonValue pickType(QWidget * parent, bool * ok = nullptr);
static void addAttribute(QTableWidget * table, QString key, QJsonValue value, bool isNew = false);
static bool deleteSelectedAttributes(QTableWidget * table);
private:
Event *event;
QTableWidget *table;
void resizeVertically();
QMap<QString, QString> getTableFields();
};
#endif // CUSTOMATTRIBUTESTABLE_H