From 74634a9317fa7df2f06ee2e50f06dc0c1962011d Mon Sep 17 00:00:00 2001 From: Richard Moe Gustavsen Date: Fri, 9 Dec 2022 12:34:36 +0100 Subject: [PATCH] QQuickTreeViewDelegate: add edit delegate docs Add some extra docs to inform that TreeViewDelegate can edit nodes in the tree. Change-Id: Iea10f6e1ca3d4bf77ca6df9a753d9c04129a82c8 Reviewed-by: Paul Wicking --- src/quicktemplates/qquicktreeviewdelegate.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/quicktemplates/qquicktreeviewdelegate.cpp b/src/quicktemplates/qquicktreeviewdelegate.cpp index 7f4731dda5..ba1a26cb34 100644 --- a/src/quicktemplates/qquicktreeviewdelegate.cpp +++ b/src/quicktemplates/qquicktreeviewdelegate.cpp @@ -101,6 +101,23 @@ QT_BEGIN_NAMESPACE user clicks on the delegate (like changing the current index), you can set \l {QQuickTableView::pointerNavigationEnabled}{pointerNavigationEnabled} to \c false. + \section2 Editing nodes in the tree + TreeViewDelegate has a default \l {TableView::editDelegate}{edit delegate} + assigned. If \l TreeView has \l {TableView::editTriggers}{edit triggers} + set, and the \l {TableView::model}{model} has support for + \l {Editing cells} {editing model items}, then the user can activate any of + the edit triggers to edit the text of the \l {TableView::current}{current} + tree node. + + The default edit delegate will try to use the \c {Qt.EditRole} to read and + write data to the \l {TableView::model}{model}. + If \l QAbstractItemModel::data() returns an empty string for this role, then + \c {Qt.DisplayRole} will be used instead. + + You can always assign your own custom edit delegate to + \l {TableView::editDelegate}{TableView.editDelegate} if you have needs + outside what the default edit delegate offers. + \sa TreeView */