summaryrefslogtreecommitdiffstats
path: root/examples/widgets/painting/deform/pathdeform.cpp
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@digia.com>2012-11-23 11:52:51 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-11-23 17:04:00 +0100
commitcbf3771e86272c10519394627784d6c1088f3a3b (patch)
treef526458bba0f2c5fe8ae1c05b678d9966a4eaf77 /examples/widgets/painting/deform/pathdeform.cpp
parent92724e533d13f56d359122d7d83ddc2316a75ef8 (diff)
QtBase: examples/widgets/painting code style
Change-Id: I3d3c6f3bae20ac8383279437f8f89c92195a704f Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'examples/widgets/painting/deform/pathdeform.cpp')
-rw-r--r--examples/widgets/painting/deform/pathdeform.cpp51
1 files changed, 18 insertions, 33 deletions
diff --git a/examples/widgets/painting/deform/pathdeform.cpp b/examples/widgets/painting/deform/pathdeform.cpp
index 418c5ffd8b..8b27fa2516 100644
--- a/examples/widgets/painting/deform/pathdeform.cpp
+++ b/examples/widgets/painting/deform/pathdeform.cpp
@@ -53,7 +53,8 @@
#include <QDesktopWidget>
#include <qmath.h>
-PathDeformControls::PathDeformControls(QWidget *parent, PathDeformRenderer* renderer, bool smallScreen)
+PathDeformControls::PathDeformControls(QWidget *parent,
+ PathDeformRenderer* renderer, bool smallScreen)
: QWidget(parent)
{
m_renderer = renderer;
@@ -64,7 +65,6 @@ PathDeformControls::PathDeformControls(QWidget *parent, PathDeformRenderer* rend
layoutForDesktop();
}
-
void PathDeformControls::layoutForDesktop()
{
QGroupBox* mainGroup = new QGroupBox(this);
@@ -223,8 +223,8 @@ void PathDeformControls::layoutForSmallScreen()
mainLayout->addWidget(okButton);
mainLayout->addWidget(quitButton);
- connect(quitButton, SIGNAL(clicked()), this, SLOT(emitQuitSignal()));
- connect(okButton, SIGNAL(clicked()), this, SLOT(emitOkSignal()));
+ connect(quitButton, SIGNAL(clicked()), this, SIGNAL(quitPressed()));
+ connect(okButton, SIGNAL(clicked()), this, SIGNAL(okPressed()));
connect(radiusSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setRadius(int)));
connect(deformSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setIntensity(int)));
connect(fontSizeSlider, SIGNAL(valueChanged(int)), m_renderer, SLOT(setFontSize(int)));
@@ -244,14 +244,6 @@ void PathDeformControls::layoutForSmallScreen()
m_renderer->setText(tr("Qt"));
}
-
-void PathDeformControls::emitQuitSignal()
-{ emit quitPressed(); }
-
-void PathDeformControls::emitOkSignal()
-{ emit okPressed(); }
-
-
PathDeformWidget::PathDeformWidget(QWidget *parent, bool smallScreen)
: QWidget(parent)
{
@@ -293,14 +285,14 @@ void PathDeformWidget::hideControls()
void PathDeformWidget::setStyle( QStyle * style )
{
QWidget::setStyle(style);
- if (m_controls != 0)
- {
- m_controls->setStyle(style);
+ if (m_controls == 0)
+ return;
+
+ m_controls->setStyle(style);
- QList<QWidget *> widgets = m_controls->findChildren<QWidget *>();
- foreach (QWidget *w, widgets)
- w->setStyle(style);
- }
+ QList<QWidget *> widgets = m_controls->findChildren<QWidget *>();
+ foreach (QWidget *w, widgets)
+ w->setStyle(style);
}
static inline QRect circle_bounds(const QPointF &center, qreal radius, qreal compensation)
@@ -445,8 +437,6 @@ void PathDeformRenderer::timerEvent(QTimerEvent *e)
m_pos += QPointF(dx, dy);
-
-
if (m_pos.x() - m_radius < 0) {
m_direction.setX(-m_direction.x());
m_pos.setX(m_radius);
@@ -565,7 +555,6 @@ QPainterPath PathDeformRenderer::lensDeform(const QPainterPath &source, const QP
return path;
}
-
void PathDeformRenderer::paint(QPainter *painter)
{
int pad_x = 5;
@@ -611,8 +600,6 @@ void PathDeformRenderer::paint(QPainter *painter)
}
}
-
-
void PathDeformRenderer::setRadius(int radius)
{
qreal max = qMax(m_radius, (qreal)radius);
@@ -620,13 +607,12 @@ void PathDeformRenderer::setRadius(int radius)
generateLensPixmap();
if (!m_animated || m_radius < max) {
#ifdef QT_OPENGL_SUPPORT
- if (usesOpenGL()) {
+ if (usesOpenGL()){
update();
- } else
-#endif
- {
- update(circle_bounds(m_pos, max, m_fontSize));
+ return;
}
+#endif
+ update(circle_bounds(m_pos, max, m_fontSize));
}
}
@@ -637,10 +623,9 @@ void PathDeformRenderer::setIntensity(int intensity)
#ifdef QT_OPENGL_SUPPORT
if (usesOpenGL()) {
update();
- } else
-#endif
- {
- update(circle_bounds(m_pos, m_radius, m_fontSize));
+ return;
}
+#endif
+ update(circle_bounds(m_pos, m_radius, m_fontSize));
}
}