diff options
author | David Schulz <david.schulz@digia.com> | 2012-11-23 14:27:50 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-25 01:34:07 +0100 |
commit | 4ac521354dfa575c31ecb732a0f8c1e18827c21e (patch) | |
tree | 20833a59d0c291c582332c4cc0f7e724d1c9b996 /examples/threads | |
parent | d5ec06be6397b807b743aa46707ff45aa9dccafa (diff) |
QtBase: example code style
Change-Id: I0685f7e2c7c698a4bf288b8b1ae909167932a3fb
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'examples/threads')
-rw-r--r-- | examples/threads/mandelbrot/main.cpp | 4 | ||||
-rw-r--r-- | examples/threads/mandelbrot/mandelbrotwidget.cpp | 15 | ||||
-rw-r--r-- | examples/threads/mandelbrot/mandelbrotwidget.h | 2 | ||||
-rw-r--r-- | examples/threads/mandelbrot/renderthread.cpp | 4 | ||||
-rw-r--r-- | examples/threads/mandelbrot/renderthread.h | 5 |
5 files changed, 13 insertions, 17 deletions
diff --git a/examples/threads/mandelbrot/main.cpp b/examples/threads/mandelbrot/main.cpp index 3800d2bbb1..cfb28fe093 100644 --- a/examples/threads/mandelbrot/main.cpp +++ b/examples/threads/mandelbrot/main.cpp @@ -38,10 +38,10 @@ ** ****************************************************************************/ -#include <QApplication> - #include "mandelbrotwidget.h" +#include <QApplication> + //! [0] int main(int argc, char *argv[]) { diff --git a/examples/threads/mandelbrot/mandelbrotwidget.cpp b/examples/threads/mandelbrot/mandelbrotwidget.cpp index 31cdceca18..c1ec029548 100644 --- a/examples/threads/mandelbrot/mandelbrotwidget.cpp +++ b/examples/threads/mandelbrot/mandelbrotwidget.cpp @@ -38,7 +38,8 @@ ** ****************************************************************************/ -#include <QtWidgets> +#include <QPainter> +#include <QKeyEvent> #include <math.h> @@ -65,8 +66,7 @@ MandelbrotWidget::MandelbrotWidget(QWidget *parent) curScale = DefaultScale; qRegisterMetaType<QImage>("QImage"); - connect(&thread, SIGNAL(renderedImage(QImage,double)), - this, SLOT(updatePixmap(QImage,double))); + connect(&thread, SIGNAL(renderedImage(QImage,double)), this, SLOT(updatePixmap(QImage,double))); setWindowTitle(tr("Mandelbrot")); #ifndef QT_NO_CURSOR @@ -85,8 +85,7 @@ void MandelbrotWidget::paintEvent(QPaintEvent * /* event */) if (pixmap.isNull()) { painter.setPen(Qt::white); - painter.drawText(rect(), Qt::AlignCenter, - tr("Rendering initial image, please wait...")); + painter.drawText(rect(), Qt::AlignCenter, tr("Rendering initial image, please wait...")); //! [2] //! [3] return; //! [3] //! [4] @@ -122,11 +121,9 @@ void MandelbrotWidget::paintEvent(QPaintEvent * /* event */) painter.setPen(Qt::NoPen); painter.setBrush(QColor(0, 0, 0, 127)); - painter.drawRect((width() - textWidth) / 2 - 5, 0, textWidth + 10, - metrics.lineSpacing() + 5); + painter.drawRect((width() - textWidth) / 2 - 5, 0, textWidth + 10, metrics.lineSpacing() + 5); painter.setPen(Qt::white); - painter.drawText((width() - textWidth) / 2, - metrics.leading() + metrics.ascent(), text); + painter.drawText((width() - textWidth) / 2, metrics.leading() + metrics.ascent(), text); } //! [9] diff --git a/examples/threads/mandelbrot/mandelbrotwidget.h b/examples/threads/mandelbrot/mandelbrotwidget.h index 6306c28adc..ea5fdc53c1 100644 --- a/examples/threads/mandelbrot/mandelbrotwidget.h +++ b/examples/threads/mandelbrot/mandelbrotwidget.h @@ -81,4 +81,4 @@ private: }; //! [0] -#endif +#endif // MANDELBROTWIDGET_H diff --git a/examples/threads/mandelbrot/renderthread.cpp b/examples/threads/mandelbrot/renderthread.cpp index 9d4b199912..ea4c18f88b 100644 --- a/examples/threads/mandelbrot/renderthread.cpp +++ b/examples/threads/mandelbrot/renderthread.cpp @@ -38,12 +38,12 @@ ** ****************************************************************************/ +#include "renderthread.h" + #include <QtWidgets> #include <math.h> -#include "renderthread.h" - //! [0] RenderThread::RenderThread(QObject *parent) : QThread(parent) diff --git a/examples/threads/mandelbrot/renderthread.h b/examples/threads/mandelbrot/renderthread.h index 61308f8b05..c292c0a676 100644 --- a/examples/threads/mandelbrot/renderthread.h +++ b/examples/threads/mandelbrot/renderthread.h @@ -59,8 +59,7 @@ public: RenderThread(QObject *parent = 0); ~RenderThread(); - void render(double centerX, double centerY, double scaleFactor, - QSize resultSize); + void render(double centerX, double centerY, double scaleFactor, QSize resultSize); signals: void renderedImage(const QImage &image, double scaleFactor); @@ -85,4 +84,4 @@ private: }; //! [0] -#endif +#endif // RENDERTHREAD_H |