summaryrefslogtreecommitdiffstats
path: root/examples/widgets/itemviews/simpletreemodel/treemodel.h
diff options
context:
space:
mode:
Diffstat (limited to 'examples/widgets/itemviews/simpletreemodel/treemodel.h')
-rw-r--r--examples/widgets/itemviews/simpletreemodel/treemodel.h14
1 files changed, 8 insertions, 6 deletions
diff --git a/examples/widgets/itemviews/simpletreemodel/treemodel.h b/examples/widgets/itemviews/simpletreemodel/treemodel.h
index aa93c33494..1a42fa585f 100644
--- a/examples/widgets/itemviews/simpletreemodel/treemodel.h
+++ b/examples/widgets/itemviews/simpletreemodel/treemodel.h
@@ -16,23 +16,25 @@ class TreeModel : public QAbstractItemModel
Q_OBJECT
public:
+ Q_DISABLE_COPY_MOVE(TreeModel)
+
explicit TreeModel(const QString &data, QObject *parent = nullptr);
- ~TreeModel();
+ ~TreeModel() override;
QVariant data(const QModelIndex &index, int role) const override;
Qt::ItemFlags flags(const QModelIndex &index) const override;
QVariant headerData(int section, Qt::Orientation orientation,
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;
private:
- void setupModelData(const QStringList &lines, TreeItem *parent);
+ static void setupModelData(const QList<QStringView> &lines, TreeItem *parent);
- TreeItem *rootItem;
+ std::unique_ptr<TreeItem> rootItem;
};
//! [0]