#ifndef CUSTOMATTRIBUTESTABLE_H #define CUSTOMATTRIBUTESTABLE_H #include #include #include class CustomAttributesTable : public QTableWidget { Q_OBJECT public: explicit CustomAttributesTable(QWidget *parent = nullptr); ~CustomAttributesTable() {}; QMap getAttributes() const; void setAttributes(const QMap attributes); void addNewAttribute(const QString &key, QJsonValue value, bool setAsDefault); bool deleteSelectedAttributes(); QSet keys() const; QSet defaultKeys() const; QSet restrictedKeys() const; void setDefaultKeys(const QSet keys); void setRestrictedKeys(const QSet keys); signals: void edited(); void defaultSet(QString key, QJsonValue value); void defaultRemoved(QString key); protected: void resizeEvent(QResizeEvent *event); private: QSet m_keys; // All keys currently in the table QSet m_defaultKeys; // All keys that are in this table by default (whether or not they're present) QSet m_restrictedKeys; // All keys not allowed in the table QPair getAttribute(int row) const; int addAttribute(const QString &key, QJsonValue value); void removeAttribute(const QString &key); void setDefaultAttribute(const QString &key, QJsonValue value); void unsetDefaultAttribute(const QString &key); void resizeVertically(); }; #endif // CUSTOMATTRIBUTESTABLE_H