diff options
author | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
---|---|---|
committer | Tobias Hunger <tobias.hunger@qt.io> | 2019-04-16 16:32:08 +0200 |
commit | 6630937e63ae5797487b86743a7733c8ae5cc42c (patch) | |
tree | 3d53dacf6430f9099e1fb20835881205de674961 /examples/widgets/widgets/tooltips/sortingbox.cpp | |
parent | 37ed6dae00640f9cc980ffda05347c12a7eb5d7e (diff) | |
parent | c7af193d2e49e9f10b86262e63d8d13abf72b5cf (diff) |
Merge commit 'dev' into 'wip/cmake-merge'
Change-Id: I176c40d031be26a1dd1cf08843e448a660598783
Diffstat (limited to 'examples/widgets/widgets/tooltips/sortingbox.cpp')
-rw-r--r-- | examples/widgets/widgets/tooltips/sortingbox.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/examples/widgets/widgets/tooltips/sortingbox.cpp b/examples/widgets/widgets/tooltips/sortingbox.cpp index 4769a30c64..685eaa7d1d 100644 --- a/examples/widgets/widgets/tooltips/sortingbox.cpp +++ b/examples/widgets/widgets/tooltips/sortingbox.cpp @@ -48,14 +48,13 @@ ** ****************************************************************************/ -#include <QtWidgets> - -#include <stdlib.h> - #include "sortingbox.h" +#include <QtWidgets> + //! [0] -SortingBox::SortingBox() +SortingBox::SortingBox(QWidget *parent) + : QWidget(parent) { //! [0] //! [1] setMouseTracking(true); @@ -63,7 +62,7 @@ SortingBox::SortingBox() setBackgroundRole(QPalette::Base); //! [2] - itemInMotion = 0; + itemInMotion = nullptr; //! [3] newCircleButton = createToolButton(tr("New Circle"), @@ -139,7 +138,7 @@ void SortingBox::paintEvent(QPaintEvent * /* event */) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing); - foreach (ShapeItem shapeItem, shapeItems) { + for (const ShapeItem &shapeItem : qAsConst(shapeItems)) { //! [8] //! [9] painter.translate(shapeItem.position()); //! [9] //! [10] @@ -178,7 +177,7 @@ void SortingBox::mouseReleaseEvent(QMouseEvent *event) { if (event->button() == Qt::LeftButton && itemInMotion) { moveItemTo(event->pos()); - itemInMotion = 0; + itemInMotion = nullptr; } } //! [13] |