qt6-bb10/examples/widgets/doc/src
Axel Spoerl 585bfe600a Fix pointer mismatch after QList::move() in tooltip example
The tooltip example moves shape items within a QWidget. Shape items are
stored in a QList of objects. When an item is moved, its pointer is
taken from the QList and stored in a member variable. To have the moved
item on the bottom of the list, QList::move() is called. This
operation re-arranges the list objects, and the member variable starts
pointing at a wrong object.

This patch changes the list from a list of objects, to a list of
pointers. Shape items are therefore allocated on the heap.
A destructor is added to free the heap with qDeleteAll.

The example's documentation is adapted accordingly and a snippet for
the destructor is added.

As a drive-by, int is replaced by qsizetype where it was used as an
index of a QList.

Fixes: QTBUG-104781
Pick-to: 6.5 6.2
Change-Id: I9be26fa7954be5f85729d24f166d66980af71801
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
2023-03-28 08:59:53 +00:00
..
addressbook-tutorial.qdoc Fix typos in docs and comments 2022-06-15 21:31:02 +02:00
addressbook.qdoc Adhere to https://wiki.qt.io/Qt6/Example-Guideline 2023-01-26 16:07:47 +01:00
affine.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
analogclock.qdoc Fix analog clock example to adhere to guidelines 2023-02-02 17:51:34 +01:00
application.qdoc Remove the 'sdi' example 2023-03-02 12:08:11 +01:00
basicdrawing.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
basicgraphicslayouts.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
basiclayouts.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
basicsortfiltermodel.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
blurpicker.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
borderlayout.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
calculator.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
calendar.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
calendarwidget.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
charactermap.qdoc Fix typos in docs and comments 2022-06-15 21:31:02 +02:00
chart.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
chip.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
classwizard.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
collidingmice-example.qdoc Fix typos in docs and comments 2022-06-15 21:31:02 +02:00
coloreditorfactory.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
combowidgetmapper.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
completer.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
composition.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
concentriccircles.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
customsortfiltermodel.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
deform.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
diagramscene.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
digitalclock.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
dirview.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
dockwidgets.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
draganddroppuzzle.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
dragdroprobot.qdoc Fix typos in docs and comments 2022-06-15 21:31:02 +02:00
draggableicons.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
draggabletext.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
dynamiclayouts.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
easing.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
echoplugin.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
editabletreemodel.qdoc Fix typos in docs and comments 2022-06-15 21:31:02 +02:00
elasticnodes.qdoc Doc: Remove duplicate words 2023-02-28 16:53:10 +00:00
embeddeddialogs.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
extension.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
fademessage.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
fetchmore.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
flowlayout.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
fontsampler.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
fridgemagnets.qdoc Doc: Remove duplicate words 2023-02-28 16:53:10 +00:00
frozencolumn.qdoc Fix typos in docs and comments 2022-06-15 21:31:02 +02:00
gallery.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
gradients.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
graphicsview-flowlayout.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
graphicsview-simpleanchorlayout.qdoc Doc: Remove broken link to Anchor Layout Example 2023-03-13 08:12:01 +00:00
groupbox.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
icons.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
imagecomposition.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
imageviewer.qdoc Fix qtbase build when all deprecated code are disabled 2023-02-22 22:27:35 +08:00
interview.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
itemviewspuzzle.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
licensewizard.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
lineedits.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
mainwindow.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
mdi.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
menus.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
movie.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
orderform.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
painterpaths.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
pathstroke.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
pixelator.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
plugandpaint.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
regularexpression.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
screenshot.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
scribble.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
settingseditor.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
shapedclock.qdoc Fix analog clock example to adhere to guidelines 2023-02-02 17:51:34 +01:00
shortcuteditor.qdoc Add a shortcut editor example 2022-10-25 14:38:46 +01:00
simpledommodel.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
simpletreemodel.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
simplewidgetmapper.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
sliders.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
spinboxdelegate.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
spinboxes.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
spreadsheet.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
standarddialogs.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
stardelegate.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
styleplugin.qdoc Doc: Fix wording in the Simple Style Plugin documentation 2023-03-21 14:49:08 +01:00
styles.qdoc Doc: Remove duplicate words 2023-02-28 16:53:10 +00:00
stylesheet.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
syntaxhighlighter.qdoc Examples: move widgets/codeeditor into manual tests 2023-02-09 00:23:34 +01:00
tabdialog.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
tablet.qdoc Fix typos in docs and comments 2022-06-15 21:31:02 +02:00
tetrix.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
textedit.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
tooltips.qdoc Fix pointer mismatch after QList::move() in tooltip example 2023-03-28 08:59:53 +00:00
transformations.qdoc Fix typos in docs and comments 2022-06-15 21:31:02 +02:00
treemodelcompleter.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
trivialwizard.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
undoframework.qdoc Merge "undo" and "undoframework" examples 2023-01-31 00:20:31 +01:00
validators.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00
windowflags.qdoc Use SPDX license identifiers 2022-05-16 16:37:38 +02:00