porymap/include/ui/customattributestable.h

44 lines
1.1 KiB
C
Raw Normal View History

#ifndef CUSTOMATTRIBUTESTABLE_H
#define CUSTOMATTRIBUTESTABLE_H
#include "events.h"
#include <QObject>
#include <QFrame>
#include <QTableWidget>
class CustomAttributesTable : public QFrame
{
Q_OBJECT
public:
explicit CustomAttributesTable(QWidget *parent = nullptr);
~CustomAttributesTable();
QMap<QString, QJsonValue> getAttributes() const;
void setAttributes(const QMap<QString, QJsonValue> attributes);
2024-01-10 18:10:28 +00:00
void addNewAttribute(const QString &key, QJsonValue value);
2024-01-10 18:10:28 +00:00
void setDefaultAttribute(const QString &key, QJsonValue value);
void unsetDefaultAttribute(const QString &key);
2024-01-09 22:03:07 +00:00
2024-01-10 18:10:28 +00:00
QSet<QString> keys() const;
QSet<QString> restrictedKeys() const;
void setRestrictedKeys(const QSet<QString> keys);
2024-01-09 22:03:07 +00:00
signals:
void edited();
private:
QTableWidget *table;
2024-01-10 18:10:28 +00:00
QSet<QString> m_keys;
QSet<QString> m_restrictedKeys;
int addAttribute(const QString &key, QJsonValue value);
void removeAttribute(const QString &key);
bool deleteSelectedAttributes();
void resizeVertically();
};
#endif // CUSTOMATTRIBUTESTABLE_H