diff options
Diffstat (limited to 'examples/corelib/threads/mandelbrot')
4 files changed, 9 insertions, 8 deletions
diff --git a/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp b/examples/corelib/threads/mandelbrot/mandelbrotwidget.cpp index b3e4af5dc8..71d0abb09f 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 @@ -117,7 +117,8 @@ void MandelbrotWidget::paintEvent(QPaintEvent * /* event */) painter.save(); painter.translate(newX, newY); painter.scale(scaleFactor, scaleFactor); - QRectF exposed = painter.matrix().inverted().mapRect(rect()).adjusted(-1, -1, 1, 1); + + QRectF exposed = painter.transform().inverted().mapRect(rect()).adjusted(-1, -1, 1, 1); painter.drawPixmap(exposed, pixmap, exposed); painter.restore(); } 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); |