summaryrefslogtreecommitdiffstats
path: root/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@digia.com>2012-11-23 14:27:50 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-25 01:34:07 +0100
commit4ac521354dfa575c31ecb732a0f8c1e18827c21e (patch)
tree20833a59d0c291c582332c4cc0f7e724d1c9b996 /examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
parentd5ec06be6397b807b743aa46707ff45aa9dccafa (diff)
QtBase: example code style
Change-Id: I0685f7e2c7c698a4bf288b8b1ae909167932a3fb Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'examples/widgets/draganddrop/puzzle/puzzlewidget.cpp')
-rw-r--r--examples/widgets/draganddrop/puzzle/puzzlewidget.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp b/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
index 3798b2ec7b..f48ef08745 100644
--- a/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
+++ b/examples/widgets/draganddrop/puzzle/puzzlewidget.cpp
@@ -38,10 +38,13 @@
**
****************************************************************************/
-#include <QtWidgets>
-
#include "puzzlewidget.h"
+#include <QDrag>
+#include <QDragEnterEvent>
+#include <QMimeData>
+#include <QPainter>
+
PuzzleWidget::PuzzleWidget(int imageSize, QWidget *parent)
: QWidget(parent), m_ImageSize(imageSize)
{
@@ -130,9 +133,8 @@ void PuzzleWidget::dropEvent(QDropEvent *event)
int PuzzleWidget::findPiece(const QRect &pieceRect) const
{
for (int i = 0; i < pieceRects.size(); ++i) {
- if (pieceRect == pieceRects[i]) {
+ if (pieceRect == pieceRects[i])
return i;
- }
}
return -1;
}
@@ -192,9 +194,8 @@ void PuzzleWidget::paintEvent(QPaintEvent *event)
painter.drawRect(highlightedRect.adjusted(0, 0, -1, -1));
}
- for (int i = 0; i < pieceRects.size(); ++i) {
+ for (int i = 0; i < pieceRects.size(); ++i)
painter.drawPixmap(pieceRects[i], piecePixmaps[i]);
- }
painter.end();
}