diff options
author | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-11-15 21:57:42 +0100 |
---|---|---|
committer | Friedemann Kleint <Friedemann.Kleint@qt.io> | 2023-12-06 18:22:41 +0100 |
commit | a3e20df03d522bd1b07ac7a85578401f36f290b9 (patch) | |
tree | f4ed5be0841a6b38e16fd1fb4bf6ddee46eadc0a /examples/widgets/doc | |
parent | 283cdcd3d5fad368c9df1bcae69cbfbf9ade623f (diff) |
Polish the SimpleTreeModel example
- Fix/silence most clang-tidy/compiler warnings
* unsigned/int comparison
* Avoid repeating return / default parameter types
* Make functions static/use static invocations
* Use string literals everywhere
* Use auto * for pointers
* Streamline code, use ternary operators
* Move constructor parameters
* Observe rule of 5 by using Q_DISABLE_COPY_MOVE
- Add some bells && whistles, resize properly, expand all
Complements 25027444a9b53d61a6257dc5f5ce0ffdb3b06f98.
Pick-to: 6.6
Change-Id: I78f48d187981ecabf69a5d4d42715bad026fa9e6
Reviewed-by: Kai Köhne <kai.koehne@qt.io>
Diffstat (limited to 'examples/widgets/doc')
-rw-r--r-- | examples/widgets/doc/src/simpletreemodel.qdoc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/examples/widgets/doc/src/simpletreemodel.qdoc b/examples/widgets/doc/src/simpletreemodel.qdoc index 55b4f139f0..10e79e2845 100644 --- a/examples/widgets/doc/src/simpletreemodel.qdoc +++ b/examples/widgets/doc/src/simpletreemodel.qdoc @@ -145,8 +145,9 @@ \snippet itemviews/simpletreemodel/treeitem.cpp 4 - Column data is returned by the \c data() function. The bounds are checked - before accessing the container with the data: + Column data is returned by the \c data() function. We use + the QList::value() convenience function which checks the bounds + and returns a default-constructed QVariant in case they are violated: \snippet itemviews/simpletreemodel/treeitem.cpp 5 |