summaryrefslogtreecommitdiffstats
path: root/examples/widgets/itemviews/editabletreemodel/treemodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/itemviews/editabletreemodel/treemodel.h')
-rw-r--r--examples/widgets/itemviews/editabletreemodel/treemodel.h22
1 files changed, 12 insertions, 10 deletions
diff --git a/examples/widgets/itemviews/editabletreemodel/treemodel.h b/examples/widgets/itemviews/editabletreemodel/treemodel.h
index 1482846c29..4f781c8144 100644
--- a/examples/widgets/itemviews/editabletreemodel/treemodel.h
+++ b/examples/widgets/itemviews/editabletreemodel/treemodel.h
@@ -16,9 +16,11 @@ class TreeModel : public QAbstractItemModel
Q_OBJECT
public:
+ Q_DISABLE_COPY_MOVE(TreeModel)
+
TreeModel(const QStringList &headers, const QString &data,
QObject *parent = nullptr);
- ~TreeModel();
+ ~TreeModel() override;
//! [0] //! [1]
QVariant data(const QModelIndex &index, int role) const override;
@@ -26,11 +28,11 @@ public:
int role = Qt::DisplayRole) const override;
QModelIndex index(int row, int column,
- const QModelIndex &parent = QModelIndex()) const override;
+ const QModelIndex &parent = {}) const override;
QModelIndex parent(const QModelIndex &index) const override;
- int rowCount(const QModelIndex &parent = QModelIndex()) const override;
- int columnCount(const QModelIndex &parent = QModelIndex()) const override;
+ int rowCount(const QModelIndex &parent = {}) const override;
+ int columnCount(const QModelIndex &parent = {}) const override;
//! [1]
//! [2]
@@ -41,19 +43,19 @@ public:
const QVariant &value, int role = Qt::EditRole) override;
bool insertColumns(int position, int columns,
- const QModelIndex &parent = QModelIndex()) override;
+ const QModelIndex &parent = {}) override;
bool removeColumns(int position, int columns,
- const QModelIndex &parent = QModelIndex()) override;
+ const QModelIndex &parent = {}) override;
bool insertRows(int position, int rows,
- const QModelIndex &parent = QModelIndex()) override;
+ const QModelIndex &parent = {}) override;
bool removeRows(int position, int rows,
- const QModelIndex &parent = QModelIndex()) override;
+ const QModelIndex &parent = {}) override;
private:
- void setupModelData(const QStringList &lines, TreeItem *parent);
+ void setupModelData(const QList<QStringView> &lines);
TreeItem *getItem(const QModelIndex &index) const;
- TreeItem *rootItem;
+ std::unique_ptr<TreeItem> rootItem;
};
//! [2]