diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2021-08-31 14:59:05 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-09-06 11:03:09 +0200 |
commit | 79cae5f6522bc259caa27b98031bfe84ef936744 (patch) | |
tree | d084a801227c98457777483e911e4d570c20af4a /examples/quick/customitems/painteditem/doc | |
parent | 485416c9d57e8ff8fe4fc0f7f4a3c4fdeaf35e98 (diff) |
Clean up the painteditem example
The way it was before it was unusable. Move the files that belong to the
TextBalloon module into their own directory, and add a wrapper
application that loads textballoons.qml with the right parameters to
actually find the TextBalloon module. Make sure that the qmldir file is
copied to the output directory.
Pick-to: 6.2
Change-Id: Ie7407a425a0a95a46de6486f9a28fd1aee07de9f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'examples/quick/customitems/painteditem/doc')
-rw-r--r-- | examples/quick/customitems/painteditem/doc/src/textballoons.qdoc | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/examples/quick/customitems/painteditem/doc/src/textballoons.qdoc b/examples/quick/customitems/painteditem/doc/src/textballoons.qdoc index 4541ba0bd9..57ffd0f6b1 100644 --- a/examples/quick/customitems/painteditem/doc/src/textballoons.qdoc +++ b/examples/quick/customitems/painteditem/doc/src/textballoons.qdoc @@ -38,16 +38,14 @@ The QQuickPaintedItem class is a class derived from QQuickItem for implementing custom QML Scene Graph items using the QPainter interfaces. - The example consists of an item class, a plugin class and a QML file - to use this plugin. The \c TextBalloon class represents the individual - text balloons extending QQuickPaintedItem, the \c TextBalloonPlugin class - represents the skeleton code for a \l {Qt Quick} plugin and the - \c textballoons.qml file is used to load the plugin and display the text - balloons. + The example consists of an item class and a QML file to use the item. The + \c TextBalloon class represents the individual text balloons extending + QQuickPaintedItem and the \c textballoons.qml file is used to load the module + containing the TextBalloon QML type and display the text balloons. We will focus on the \c TextBalloon class first and continue with the - \c textballoons.qml file. For an example on how to implement a \l {Qt Quick} - plugin please look at \l{Chapter 6: Writing an Extension Plugin} + \c textballoons.qml file. For an example on how to implement a plugin for a + QML module please look at \l{Chapter 6: Writing an Extension Plugin} {Writing an Extension Plugin} \section1 TextBalloon Class Declaration @@ -56,7 +54,7 @@ is the base class for all QPainter based items in the QML Scene Graph framework. - \snippet customitems/painteditem/textballoon.h 0 + \snippet customitems/painteditem/TextBalloon/textballoon.h 0 To implement a QQuickPaintedItem you must implement QQuickPaintedIem's pure virtual function \l {QQuickPaintedItem::}{paint()} which implements the @@ -67,13 +65,13 @@ We have to be sure to initialize the rightAligned property for a TextBalloon item. - \snippet customitems/painteditem/textballoon.cpp 0 + \snippet customitems/painteditem/TextBalloon/textballoon.cpp 0 Then we implement the \c paint() function which is automatically called by the Scene Graph framework to paint the contents of the item. The function paints the item in local coordinates. - \snippet customitems/painteditem/textballoon.cpp 1 + \snippet customitems/painteditem/TextBalloon/textballoon.cpp 1 We start with setting the pen and brush on the item to define the look of the item. After that we start drawing. Note that the \l {QQuickPaintedItem::}{contentsBoundingRect()} @@ -81,7 +79,7 @@ returned by the \l {QQuickPaintedItem::}{contentsBoundingRect()} function is the size of the item as defined in the QML file. - \section1 Textballoons.qml File + \section1 textballoons.qml File The Interface consists of two main parts. The scrollable area with the textballoons and the controls button to add new balloons. |