MCPcopy Create free account
hub / github.com/KDE/labplot / TreeModel

Class TreeModel

src/backend/worksheet/TreeModel.h:50–80  ·  view source on GitHub ↗

! * \brief The TreeModel class * This is an abstract treemodel which can be used by a treeview */

Source from the content-addressed store, hash-verified

48 * This is an abstract treemodel which can be used by a treeview
49 */
50class TreeModel : public QAbstractItemModel {
51 Q_OBJECT
52
53public:
54 explicit TreeModel(const QStringList& headers, QObject* parent = nullptr);
55 ~TreeModel();
56 QVariant treeData(const int row, const int column, const QModelIndex& parent = QModelIndex(), const int role = Qt::EditRole);
57 QVariant data(const QModelIndex&, int role) const override;
58 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
59
60 QModelIndex index(int row, int column, const QModelIndex& parent = QModelIndex()) const override;
61 QModelIndex parent(const QModelIndex&) const override;
62
63 int rowCount(const QModelIndex& parent = QModelIndex()) const override;
64 int columnCount(const QModelIndex& parent = QModelIndex()) const override;
65
66 Qt::ItemFlags flags(const QModelIndex&) const override;
67 bool setTreeData(const QVariant& data, const int row, const int column, const QModelIndex& parent = QModelIndex(), int role = Qt::EditRole);
68 bool setData(const QModelIndex&, const QVariant& value, int role = Qt::EditRole) override;
69 int compareStrings(const QString& value, const int row, const int column, const QModelIndex& parent = QModelIndex());
70 bool setHeaderData(int section, Qt::Orientation orientation, const QVariant& value, int role = Qt::EditRole) override;
71
72 bool insertColumns(int position, int columns, const QModelIndex& parent = QModelIndex()) override;
73 bool removeColumns(int position, int columns, const QModelIndex& parent = QModelIndex()) override;
74 bool insertRows(int position, int rows, const QModelIndex& parent = QModelIndex()) override;
75 bool removeRows(int position, int rows, const QModelIndex& parent = QModelIndex()) override;
76
77private:
78 TreeItem* getItem(const QModelIndex&) const;
79 TreeItem* rootItem{nullptr};
80};
81
82#endif // TREEMODEL_H

Callers

nothing calls this directly

Calls 1

QModelIndexClass · 0.50

Tested by

no test coverage detected