Tome
A generic data editor for games supporting arbitrary input and output formats.
recordtreewidgetitem.h
1 #ifndef RECORDTREEWIDGETITEM_H
2 #define RECORDTREEWIDGETITEM_H
3 
4 #include <QTreeWidgetItem>
5 
6 namespace Tome
7 {
11  class RecordTreeWidgetItem : public QTreeWidgetItem
12  {
13  public:
21  RecordTreeWidgetItem(const QVariant& id, const QString& displayName, const QVariant& parentId, const bool readOnly);
22 
27  QVariant getId() const;
28 
33  QString getDisplayName() const;
34 
39  QVariant getParentId() const;
40 
45  bool isReadOnly() const;
46 
51  void setId(const QVariant& id);
52 
57  void setDisplayName(const QString& displayName);
58 
63  void setParentId(const QVariant& parentId);
64 
69  void setReadOnly(const bool readOnly);
70 
78  bool operator<(const QTreeWidgetItem& other) const Q_DECL_OVERRIDE
79  {
80  return this->text(0) >= other.text(0);
81  }
82 
83  private:
84  QVariant id;
85  QString displayName;
86  QVariant parentId;
87  bool readOnly;
88  };
89 }
90 
91 #endif // RECORDTREEWIDGETITEM_H
Definition: commandlineoptions.h:6
void setParentId(const QVariant &parentId)
Sets the id of the parent of the record in the hierarchy.
Definition: recordtreewidgetitem.cpp:47
bool isReadOnly() const
Gets whether to prevent the record from being edited, reparented or removed.
Definition: recordtreewidgetitem.cpp:30
void setReadOnly(const bool readOnly)
Sets whether to prevent the record from being edited, reparented or removed.
Definition: recordtreewidgetitem.cpp:52
void setDisplayName(const QString &displayName)
Sets the display name of the record to show in the hierarchy.
Definition: recordtreewidgetitem.cpp:41
Selectable item in the record hierarchy.
Definition: recordtreewidgetitem.h:11
QVariant getId() const
Gets the unique id of the record.
Definition: recordtreewidgetitem.cpp:15
QVariant getParentId() const
Gets the id of the parent of the record in the hierarchy.
Definition: recordtreewidgetitem.cpp:25
bool operator<(const QTreeWidgetItem &other) const Q_DECL_OVERRIDE
Compares this record tree widget item with the specified other one for order.
Definition: recordtreewidgetitem.h:78
RecordTreeWidgetItem(const QVariant &id, const QString &displayName, const QVariant &parentId, const bool readOnly)
Constructs a new selectable item in the record hierarchy.
Definition: recordtreewidgetitem.cpp:6
void setId(const QVariant &id)
Sets the unique id of the record.
Definition: recordtreewidgetitem.cpp:35
QString getDisplayName() const
Gets the display name of the record.
Definition: recordtreewidgetitem.cpp:20