2019-02-03 18:26:27 +00:00
|
|
|
#ifndef CUSTOMATTRIBUTESTABLE_H
|
|
|
|
#define CUSTOMATTRIBUTESTABLE_H
|
|
|
|
|
2022-07-19 22:56:12 +01:00
|
|
|
#include "events.h"
|
2019-02-03 18:26:27 +00:00
|
|
|
#include <QObject>
|
|
|
|
#include <QFrame>
|
|
|
|
#include <QTableWidget>
|
|
|
|
|
|
|
|
class CustomAttributesTable : public QFrame
|
|
|
|
{
|
2024-01-09 02:06:25 +00:00
|
|
|
Q_OBJECT
|
|
|
|
|
2019-02-03 18:26:27 +00:00
|
|
|
public:
|
2024-01-09 02:06:25 +00:00
|
|
|
explicit CustomAttributesTable(QWidget *parent = nullptr);
|
2019-02-03 18:26:27 +00:00
|
|
|
~CustomAttributesTable();
|
|
|
|
|
2024-01-09 02:06:25 +00:00
|
|
|
QMap<QString, QJsonValue> getAttributes() const;
|
|
|
|
void setAttributes(const QMap<QString, QJsonValue> attributes);
|
2024-01-10 20:59:27 +00:00
|
|
|
void addNewAttribute(const QString &key, QJsonValue value, bool setAsDefault);
|
2024-01-09 22:03:07 +00:00
|
|
|
|
2024-01-10 18:10:28 +00:00
|
|
|
QSet<QString> keys() const;
|
2024-01-10 20:59:27 +00:00
|
|
|
QSet<QString> defaultKeys() const;
|
2024-01-10 18:10:28 +00:00
|
|
|
QSet<QString> restrictedKeys() const;
|
2024-01-10 20:59:27 +00:00
|
|
|
void setDefaultKeys(const QSet<QString> keys);
|
2024-01-10 18:10:28 +00:00
|
|
|
void setRestrictedKeys(const QSet<QString> keys);
|
2024-01-09 22:03:07 +00:00
|
|
|
|
2024-01-09 02:06:25 +00:00
|
|
|
signals:
|
|
|
|
void edited();
|
2024-01-10 20:59:27 +00:00
|
|
|
void defaultSet(QString key, QJsonValue value);
|
|
|
|
void defaultRemoved(QString key);
|
2022-10-19 00:52:35 +01:00
|
|
|
|
2019-02-03 18:26:27 +00:00
|
|
|
private:
|
|
|
|
QTableWidget *table;
|
2024-01-10 18:10:28 +00:00
|
|
|
|
2024-01-10 20:59:27 +00:00
|
|
|
QSet<QString> m_keys; // All keys currently in the table
|
|
|
|
QSet<QString> m_defaultKeys; // All keys that are in this table by default (whether or not they're present)
|
|
|
|
QSet<QString> m_restrictedKeys; // All keys not allowed in the table
|
2024-01-10 18:10:28 +00:00
|
|
|
|
|
|
|
int addAttribute(const QString &key, QJsonValue value);
|
|
|
|
void removeAttribute(const QString &key);
|
|
|
|
bool deleteSelectedAttributes();
|
2024-01-10 20:59:27 +00:00
|
|
|
void setDefaultAttribute(const QString &key, QJsonValue value);
|
|
|
|
void unsetDefaultAttribute(const QString &key);
|
2019-02-03 18:26:27 +00:00
|
|
|
void resizeVertically();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CUSTOMATTRIBUTESTABLE_H
|