C++ docs: For the model bits, link to the for-in and ListView docs

Using an rst epiloge we can define global references that are even formatted
(using rst substitutions)
This commit is contained in:
Simon Hausmann 2021-07-02 12:30:36 +02:00
parent decd151b84
commit f8abd57c3b
2 changed files with 12 additions and 3 deletions

View file

@ -101,5 +101,12 @@ myst_enable_extensions = [
# Annotate h1/h2 elements with anchors
myst_heading_anchors = 2
rst_epilog = """
.. |ListView| replace:: :code:`ListView`
.. _ListView: ../markdown/widgets.html#listview
.. |Repetition| replace:: :code:`for` - :code:`in`
.. _Repetition: ../markdown/langref.html#repetition
"""
def setup(app):
app.add_css_file('theme_tweak.css')

View file

@ -51,7 +51,7 @@ struct ItemVTable;
/// :cpp:class:`sixtyfps::ComponentHandle` is in scope, similar to :code:`std::shared_ptr<T>`.
///
/// For more complex UIs it is common to supply data in the form of an abstract data model, that is
/// used with :code:`for` - :code:`in` repetitions or :code:`ListView` elements in the :code:`.60`
/// used with |Repetition|_ repetitions or |ListView|_ elements in the :code:`.60`
/// language. All models in C++ are sub-classes of the :cpp:class:`sixtyfps::Model` and you can
/// sub-class it yourself. For convenience, the :cpp:class:`sixtyfps::VectorModel` provides an
/// implementation that is backed by a :code:`std::vector<T>`.
@ -349,8 +349,10 @@ using ModelPeer = std::weak_ptr<AbstractRepeaterView>;
} // namespace private_api
/// A Model is providing Data for :code:`for` - :code:`in` repetitions or ListView elements of the
/// `.60` language
/// \rst
/// A Model is providing Data for |Repetition|_ repetitions or |ListView|_ elements of the
/// :code:`.60` language
/// \endrst
template<typename ModelData>
class Model
{