diff options
author | David Schulz <david.schulz@digia.com> | 2012-11-23 11:52:51 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2012-11-23 17:04:00 +0100 |
commit | cbf3771e86272c10519394627784d6c1088f3a3b (patch) | |
tree | f526458bba0f2c5fe8ae1c05b678d9966a4eaf77 /examples/widgets/painting/painterpaths | |
parent | 92724e533d13f56d359122d7d83ddc2316a75ef8 (diff) |
QtBase: examples/widgets/painting code style
Change-Id: I3d3c6f3bae20ac8383279437f8f89c92195a704f
Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'examples/widgets/painting/painterpaths')
5 files changed, 22 insertions, 32 deletions
diff --git a/examples/widgets/painting/painterpaths/main.cpp b/examples/widgets/painting/painterpaths/main.cpp index a244f67d66..903795685f 100644 --- a/examples/widgets/painting/painterpaths/main.cpp +++ b/examples/widgets/painting/painterpaths/main.cpp @@ -38,10 +38,10 @@ ** ****************************************************************************/ -#include <QApplication> - #include "window.h" +#include <QApplication> + int main(int argc, char *argv[]) { QApplication app(argc, argv); diff --git a/examples/widgets/painting/painterpaths/renderarea.cpp b/examples/widgets/painting/painterpaths/renderarea.cpp index ad22f27fe1..e57dd6dafe 100644 --- a/examples/widgets/painting/painterpaths/renderarea.cpp +++ b/examples/widgets/painting/painterpaths/renderarea.cpp @@ -38,10 +38,10 @@ ** ****************************************************************************/ -#include <QtWidgets> - #include "renderarea.h" +#include <QPainter> + //! [0] RenderArea::RenderArea(const QPainterPath &path, QWidget *parent) : QWidget(parent), path(path) @@ -119,8 +119,7 @@ void RenderArea::paintEvent(QPaintEvent *) painter.translate(-50.0, -50.0); //! [9] //! [10] - painter.setPen(QPen(penColor, penWidth, Qt::SolidLine, Qt::RoundCap, - Qt::RoundJoin)); + painter.setPen(QPen(penColor, penWidth, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin)); QLinearGradient gradient(0, 0, 0, 100); gradient.setColorAt(0.0, fillColor1); gradient.setColorAt(1.0, fillColor2); diff --git a/examples/widgets/painting/painterpaths/renderarea.h b/examples/widgets/painting/painterpaths/renderarea.h index 681f7a7930..98327a90b8 100644 --- a/examples/widgets/painting/painterpaths/renderarea.h +++ b/examples/widgets/painting/painterpaths/renderarea.h @@ -77,4 +77,4 @@ private: }; //! [1] -#endif +#endif // RENDERAREA_H diff --git a/examples/widgets/painting/painterpaths/window.cpp b/examples/widgets/painting/painterpaths/window.cpp index 1a29799cd6..e5e427506b 100644 --- a/examples/widgets/painting/painterpaths/window.cpp +++ b/examples/widgets/painting/painterpaths/window.cpp @@ -38,13 +38,13 @@ ** ****************************************************************************/ +#include "renderarea.h" +#include "window.h" + #include <QtWidgets> #include <math.h> -#include "renderarea.h" -#include "window.h" - //! [0] const float Pi = 3.14159f; //! [0] @@ -153,13 +153,11 @@ Window::Window() //! [12] fillColor1ComboBox = new QComboBox; populateWithColors(fillColor1ComboBox); - fillColor1ComboBox->setCurrentIndex( - fillColor1ComboBox->findText("mediumslateblue")); + fillColor1ComboBox->setCurrentIndex(fillColor1ComboBox->findText("mediumslateblue")); fillColor2ComboBox = new QComboBox; populateWithColors(fillColor2ComboBox); - fillColor2ComboBox->setCurrentIndex( - fillColor2ComboBox->findText("cornsilk")); + fillColor2ComboBox->setCurrentIndex(fillColor2ComboBox->findText("cornsilk")); fillGradientLabel = new QLabel(tr("&Fill Gradient:")); fillGradientLabel->setBuddy(fillColor1ComboBox); @@ -175,8 +173,7 @@ Window::Window() penColorComboBox = new QComboBox; populateWithColors(penColorComboBox); - penColorComboBox->setCurrentIndex( - penColorComboBox->findText("darkslateblue")); + penColorComboBox->setCurrentIndex(penColorComboBox->findText("darkslateblue")); penColorLabel = new QLabel(tr("Pen &Color:")); penColorLabel->setBuddy(penColorComboBox); @@ -191,20 +188,14 @@ Window::Window() //! [12] //! [16] - connect(fillRuleComboBox, SIGNAL(activated(int)), - this, SLOT(fillRuleChanged())); - connect(fillColor1ComboBox, SIGNAL(activated(int)), - this, SLOT(fillGradientChanged())); - connect(fillColor2ComboBox, SIGNAL(activated(int)), - this, SLOT(fillGradientChanged())); - connect(penColorComboBox, SIGNAL(activated(int)), - this, SLOT(penColorChanged())); + connect(fillRuleComboBox, SIGNAL(activated(int)), this, SLOT(fillRuleChanged())); + connect(fillColor1ComboBox, SIGNAL(activated(int)), this, SLOT(fillGradientChanged())); + connect(fillColor2ComboBox, SIGNAL(activated(int)), this, SLOT(fillGradientChanged())); + connect(penColorComboBox, SIGNAL(activated(int)), this, SLOT(penColorChanged())); for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++) { - connect(penWidthSpinBox, SIGNAL(valueChanged(int)), - *it, SLOT(setPenWidth(int))); - connect(rotationAngleSpinBox, SIGNAL(valueChanged(int)), - *it, SLOT(setRotationAngle(int))); + connect(penWidthSpinBox, SIGNAL(valueChanged(int)), *it, SLOT(setPenWidth(int))); + connect(rotationAngleSpinBox, SIGNAL(valueChanged(int)), *it, SLOT(setRotationAngle(int))); } //! [16] //! [17] @@ -246,7 +237,7 @@ void Window::fillRuleChanged() { Qt::FillRule rule = (Qt::FillRule)currentItemData(fillRuleComboBox).toInt(); - for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++) + for (QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); ++it) (*it)->setFillRule(rule); } //! [19] @@ -257,7 +248,7 @@ void Window::fillGradientChanged() QColor color1 = qvariant_cast<QColor>(currentItemData(fillColor1ComboBox)); QColor color2 = qvariant_cast<QColor>(currentItemData(fillColor2ComboBox)); - for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++) + for (QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); ++it) (*it)->setFillGradient(color1, color2); } //! [20] @@ -267,7 +258,7 @@ void Window::penColorChanged() { QColor color = qvariant_cast<QColor>(currentItemData(penColorComboBox)); - for(QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); it++) + for (QList<RenderArea*>::iterator it = renderAreas.begin(); it != renderAreas.end(); ++it) (*it)->setPenColor(color); } //! [21] diff --git a/examples/widgets/painting/painterpaths/window.h b/examples/widgets/painting/painterpaths/window.h index 3c0f27ceac..ae98d69352 100644 --- a/examples/widgets/painting/painterpaths/window.h +++ b/examples/widgets/painting/painterpaths/window.h @@ -87,4 +87,4 @@ private: }; //! [2] -#endif +#endif // WINDOW_H |