diff options
author | Christian Ehrlicher <ch.ehrlicher@gmx.de> | 2019-02-03 17:09:10 +0100 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2019-02-06 22:11:27 +0000 |
commit | 4715ca7bc54fc1f30dd7e603a396c876d667c92c (patch) | |
tree | c18936b1b194f7820dfbe5c74214f252ec0a10e6 /examples/corelib/threads/mandelbrot | |
parent | 7910dd0a548cdd9e7c5716d4f6704b3185fa34fb (diff) |
Cleanup QtCore examples
Cleanup QtCore examples:
- use new signal/slot syntax
- use 0 instead nullptr
- remove unneeded includes
- use initializer lists
- replace foreach with range-based-for loop
Change-Id: I5581f485fa0e9ccf3f4ce6f643908832bc6959bb
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'examples/corelib/threads/mandelbrot')
4 files changed, 7 insertions, 7 deletions
diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp index b3e4af5dc8..2603f041b2 100644 --- a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp +++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp @@ -48,14 +48,13 @@ ** ****************************************************************************/ +#include "mandelbrotwidget.h" + #include <QPainter> #include <QKeyEvent> #include <math.h> -#include "mandelbrotwidget.h" - - //! [0] const double DefaultCenterX = -0.637011f; const double DefaultCenterY = -0.0395159f; @@ -75,7 +74,8 @@ MandelbrotWidget::MandelbrotWidget(QWidget *parent) pixmapScale = DefaultScale; curScale = DefaultScale; - connect(&thread, SIGNAL(renderedImage(QImage,double)), this, SLOT(updatePixmap(QImage,double))); + connect(&thread, &RenderThread::renderedImage, + this, &MandelbrotWidget::updatePixmap); setWindowTitle(tr("Mandelbrot")); #ifndef QT_NO_CURSOR diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.h b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h index a04bfa6e81..cb40962535 100644 --- a/examples/corelib/threads/mandelbrot/mandelbrotwidget.h +++ b/examples/corelib/threads/mandelbrot/mandelbrotwidget.h @@ -62,7 +62,7 @@ class MandelbrotWidget : public QWidget Q_OBJECT public: - MandelbrotWidget(QWidget *parent = 0); + MandelbrotWidget(QWidget *parent = nullptr); protected: void paintEvent(QPaintEvent *event) override; diff --git a/examples/corelib/threads/mandelbrot/renderthread.cpp b/examples/corelib/threads/mandelbrot/renderthread.cpp index c57b696e25..eee44c7242 100644 --- a/examples/corelib/threads/mandelbrot/renderthread.cpp +++ b/examples/corelib/threads/mandelbrot/renderthread.cpp @@ -50,7 +50,7 @@ #include "renderthread.h" -#include <QtWidgets> +#include <QImage> #include <cmath> //! [0] diff --git a/examples/corelib/threads/mandelbrot/renderthread.h b/examples/corelib/threads/mandelbrot/renderthread.h index b5e9226fb8..4f0394d554 100644 --- a/examples/corelib/threads/mandelbrot/renderthread.h +++ b/examples/corelib/threads/mandelbrot/renderthread.h @@ -66,7 +66,7 @@ class RenderThread : public QThread Q_OBJECT public: - RenderThread(QObject *parent = 0); + RenderThread(QObject *parent = nullptr); ~RenderThread(); void render(double centerX, double centerY, double scaleFactor, QSize resultSize); |