From 879f98106d5974ef19c96cb228ca032701b94556 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 24 Aug 2017 11:19:21 +0200 Subject: Revamp QtWidgets/DragAndDrop examples to C++11 Introduce nullptr and replace foreach with new C++11 range based for loops. Minor fixups of signals, file dialog usage. Apply the same changes to the ItemViews/puzzle example since it shares parts of the code with DragAndDrop/puzzle. Make some changes to both examples to that the diff of the two becomes small for easier comparison. Task-number: QTBUG-60635 Change-Id: I8af824229ebac24d6ec151eae92176d227695490 Reviewed-by: Venugopal Shivashankar Reviewed-by: Gatis Paeglis --- examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp | 2 +- examples/widgets/draganddrop/fridgemagnets/dragwidget.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/widgets/draganddrop/fridgemagnets') diff --git a/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp b/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp index b185b2900d..451b53f623 100644 --- a/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp +++ b/examples/widgets/draganddrop/fridgemagnets/dragwidget.cpp @@ -167,7 +167,7 @@ void DragWidget::dropEvent(QDropEvent *event) QString::SkipEmptyParts); QPoint position = event->pos(); - foreach (const QString &piece, pieces) { + for (const QString &piece : pieces) { DragLabel *newLabel = new DragLabel(piece, this); newLabel->move(position); newLabel->show(); diff --git a/examples/widgets/draganddrop/fridgemagnets/dragwidget.h b/examples/widgets/draganddrop/fridgemagnets/dragwidget.h index 104e500134..ff513a33d8 100644 --- a/examples/widgets/draganddrop/fridgemagnets/dragwidget.h +++ b/examples/widgets/draganddrop/fridgemagnets/dragwidget.h @@ -62,7 +62,7 @@ QT_END_NAMESPACE class DragWidget : public QWidget { public: - DragWidget(QWidget *parent = 0); + explicit DragWidget(QWidget *parent = nullptr); protected: void dragEnterEvent(QDragEnterEvent *event) override; -- cgit v1.2.3