aboutsummaryrefslogtreecommitdiffstats
path: root/examples/widgets/richtext/textobject/doc/textobject.rst
diff options
context:
space:
mode:
authorCristian Maureira-Fredes <Cristian.Maureira-Fredes@qt.io>2021-06-10 22:46:36 +0200
committerCristian Maureira-Fredes <cristian.maureira-fredes@qt.io>2021-06-12 19:31:17 +0000
commit32222315eb32177d4161ee2e417d9910a07f6039 (patch)
tree41981da131e6adec81854066d060315fd2bce3bd /examples/widgets/richtext/textobject/doc/textobject.rst
parent5276f9bf787eadd5a336f5f6eb6bcf19865de198 (diff)
examples: add screenshots to widgets and others
Adding screenshots to: - declarative - multimedia - network - widgets Renaming examples to avoid conflict on images names. Task-number: PYSIDE-841 Pick-to: 6.1 Change-Id: I21f403ee62b45c0cb2a45eca6c5c99f11901610e Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'examples/widgets/richtext/textobject/doc/textobject.rst')
-rw-r--r--examples/widgets/richtext/textobject/doc/textobject.rst31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/widgets/richtext/textobject/doc/textobject.rst b/examples/widgets/richtext/textobject/doc/textobject.rst
new file mode 100644
index 000000000..d5a1e253a
--- /dev/null
+++ b/examples/widgets/richtext/textobject/doc/textobject.rst
@@ -0,0 +1,31 @@
+TextObject Example
+==================
+
+A QTextDocument consists of a hierarchy of elements, such as text blocks and
+frames. A text object describes the structure or format of one or more of these
+elements. For instance, images imported from HTML are implemented using text
+objects. Text objects are used by the document's layout to lay out and render
+(paint) the document. Each object knows how to paint the elements they govern,
+and calculates their size.
+
+To be able to insert an SVG image into a text document, we create a text
+object, and implement painting for that object. This object can then be set on
+a QTextCharFormat. We also register the text object with the layout of the
+document, enabling it to draw QTextCharFormats governed by our text object. We
+can summarize the procedure with the following steps:
+
+ * Implement the text object.
+ * Register the text object with the layout of the text document.
+ * Set the text object on a QTextCharFormat.
+ * Insert a QChar::ObjectReplacementCharacter with that text char format into
+ the document.
+
+The example consists of the following classes:
+
+ * SvgTextObject implements the text object.
+ * Window shows a QTextEdit into which SVG images can be inserted.
+
+
+.. image:: textobject.png
+ :width: 400
+ :alt: TextObject Screenshot