585bfe600a
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> |
||
---|---|---|
.. | ||
analogclock | ||
calculator | ||
calendarwidget | ||
charactermap | ||
digitalclock | ||
groupbox | ||
icons | ||
imageviewer | ||
lineedits | ||
movie | ||
scribble | ||
shapedclock | ||
shortcuteditor | ||
sliders | ||
spinboxes | ||
styles | ||
stylesheet | ||
tablet | ||
tetrix | ||
tooltips | ||
validators | ||
windowflags | ||
CMakeLists.txt | ||
README | ||
widgets.pro |
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.