From 9e02051e12433e7c2a4e3b818f6e9f21a5983c05 Mon Sep 17 00:00:00 2001 From: James Westman Date: Tue, 16 May 2023 17:33:37 -0500 Subject: [PATCH] docs: Fix ExtListItemFactory example & description --- docs/reference/extensions.rst | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/docs/reference/extensions.rst b/docs/reference/extensions.rst index bfa0c56..f7b42b1 100644 --- a/docs/reference/extensions.rst +++ b/docs/reference/extensions.rst @@ -187,28 +187,30 @@ Gtk.BuilderListItemFactory Templates .. rst-class:: grammar-block - ExtListItemFactory = 'template' :ref:`ObjectContent` + ExtListItemFactory = 'template' :ref:`TypeName` :ref:`ObjectContent` Valid in `Gtk.BuilderListItemFactory `_. -The ``template`` block defines the template that will be used to create list items. This block is unique within Blueprint because it defines a completely separate sub-blueprint which is used to create the list items. The sub-blueprint may not reference objects in the main blueprint or vice versa. +The ``template`` block defines the template that will be used to create list items. This block is unique within Blueprint because it defines a completely separate sub-blueprint which is used to create each list item. The sub-blueprint may not reference objects in the main blueprint or vice versa. -The template type is `Gtk.ListItem `_, and the template should have a ``child`` property. +The template type must be `Gtk.ListItem `_. The template object can be referenced with the ``template`` keyword. .. code-block:: blueprintui - ListBox { - factory: ListItemFactory { - template { + ListView { + factory: BuilderListItemFactory { + template ListItem { child: Label { - label: bind item.string; + label: bind template.item as .string; }; } - } + }; - model: StringList { - strings [ "Item 1", "Item 2", "Item 3" ] - } + model: NoSelection { + model: StringList { + strings [ "Item 1", "Item 2", "Item 3" ] + }; + }; }