qt5base-lts/examples/widgets/widgets
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
..
analogclock Remove "Analog Clock Window Example" 2023-02-07 17:34:42 +00:00
calculator examples: port widget examples to new connection style 2023-02-25 22:11:57 +01:00
calendarwidget Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
charactermap Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
digitalclock Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
groupbox Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
icons examples: Connect Quit action to QCoreApplication::quit, not QWidget::close 2023-02-20 15:18:18 +01:00
imageviewer Fix qtbase build when all deprecated code are disabled 2023-02-22 22:27:35 +08:00
lineedits Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
movie Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
scribble Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
shapedclock Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
shortcuteditor Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
sliders Fix unused variable compiler warning in slider example 2023-01-05 05:21:43 +00:00
spinboxes Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
styles Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
stylesheet Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
tablet Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
tetrix Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
tooltips Fix pointer mismatch after QList::move() in tooltip example 2023-03-28 08:59:53 +00:00
validators Examples: Add missing include guards 2023-02-01 18:12:36 +00:00
windowflags Examples: Use PRIVATE CMake linkage 2022-11-30 14:48:50 +01:00
CMakeLists.txt Examples: move widgets/codeeditor into manual tests 2023-02-09 00:23:34 +01:00
README
widgets.pro Examples: move widgets/codeeditor into manual tests 2023-02-09 00:23:34 +01:00

Qt comes with a large range of standard widgets that users of modern
applications have come to expect.

You can also develop your own custom widgets and controls, and use them
alongside standard widgets.

It is even possible to provide custom styles and themes for widgets that can
be used to change the appearance of standard widgets and appropriately
written custom widgets.


Documentation for these examples can be found via the Examples
link in the main Qt documentation.