aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual/treeview
diff options
context:
space:
mode:
authorRichard Moe Gustavsen <richard.gustavsen@qt.io>2022-11-30 14:36:43 +0100
committerRichard Moe Gustavsen <richard.gustavsen@qt.io>2022-12-08 23:33:42 +0100
commit21bf976a411a65a1c945aae994afbcb8590e50e4 (patch)
tree28394b9dc650e9aec042b1967b05c732103f32ca /tests/manual/treeview
parent52cbcd947db2219aecb2f6cb59bc6676a7c61e48 (diff)
QQuickTreeViewDelegate: implement edit delegates
This patch will implement a default edit delegate for the TreeViewDelegates, for all our styles. [ChangeLog][Controls] TreeViewDelegate got support for editing nodes in the tree. Change-Id: Iec5936e4439770586837daa3b8045482b75a15f2 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'tests/manual/treeview')
-rw-r--r--tests/manual/treeview/sidebyside/data/treeview.qml2
-rw-r--r--tests/manual/treeview/sidebyside/testmodel.cpp5
-rw-r--r--tests/manual/treeview/sidebyside/testmodel.h2
3 files changed, 9 insertions, 0 deletions
diff --git a/tests/manual/treeview/sidebyside/data/treeview.qml b/tests/manual/treeview/sidebyside/data/treeview.qml
index fc5d102b2e..6c51b7c413 100644
--- a/tests/manual/treeview/sidebyside/data/treeview.qml
+++ b/tests/manual/treeview/sidebyside/data/treeview.qml
@@ -80,6 +80,8 @@ ApplicationWindow {
anchors.topMargin: 100
clip: true
+ selectionModel: ItemSelectionModel {}
+
model: useFileSystemModel.checked ? fileSystemModel : testModel
delegate: useCustomDelegate.checked ? customDelegate : treeViewDelegate
}
diff --git a/tests/manual/treeview/sidebyside/testmodel.cpp b/tests/manual/treeview/sidebyside/testmodel.cpp
index f5c4f2ab04..3b70ea7ab5 100644
--- a/tests/manual/treeview/sidebyside/testmodel.cpp
+++ b/tests/manual/treeview/sidebyside/testmodel.cpp
@@ -162,3 +162,8 @@ bool TestModel::removeRows(int position, int count, const QModelIndex &parent)
return true;
}
+Qt::ItemFlags TestModel::flags(const QModelIndex &index) const
+{
+ Q_UNUSED(index)
+ return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsEditable;
+}
diff --git a/tests/manual/treeview/sidebyside/testmodel.h b/tests/manual/treeview/sidebyside/testmodel.h
index 8dd7c81231..86007f0d7f 100644
--- a/tests/manual/treeview/sidebyside/testmodel.h
+++ b/tests/manual/treeview/sidebyside/testmodel.h
@@ -43,6 +43,8 @@ public:
Q_INVOKABLE bool insertRows(int position, int count, const QModelIndex &parent) override;
Q_INVOKABLE bool removeRows(int position, int count, const QModelIndex &parent) override;
+ Qt::ItemFlags flags(const QModelIndex &index) const override;
+
private:
QVector<TreeItem *> m_rootItems;
int m_columnCount = 2;