summaryrefslogtreecommitdiffstats
path: root/examples
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
parent92724e533d13f56d359122d7d83ddc2316a75ef8 (diff)
QtBase: examples/widgets/painting code style
Change-Id: I3d3c6f3bae20ac8383279437f8f89c92195a704f Reviewed-by: hjk <qthjk@ovi.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/widgets/painting/affine/xform.h5
-rw-r--r--examples/widgets/painting/basicdrawing/main.cpp4
-rw-r--r--examples/widgets/painting/basicdrawing/renderarea.cpp4
-rw-r--r--examples/widgets/painting/basicdrawing/renderarea.h2
-rw-r--r--examples/widgets/painting/basicdrawing/window.cpp4
-rw-r--r--examples/widgets/painting/basicdrawing/window.h2
-rw-r--r--examples/widgets/painting/composition/composition.cpp66
-rw-r--r--examples/widgets/painting/composition/composition.h6
-rw-r--r--examples/widgets/painting/composition/main.cpp2
-rw-r--r--examples/widgets/painting/concentriccircles/circlewidget.cpp15
-rw-r--r--examples/widgets/painting/concentriccircles/circlewidget.h2
-rw-r--r--examples/widgets/painting/concentriccircles/main.cpp4
-rw-r--r--examples/widgets/painting/concentriccircles/window.cpp4
-rw-r--r--examples/widgets/painting/concentriccircles/window.h2
-rw-r--r--examples/widgets/painting/deform/main.cpp1
-rw-r--r--examples/widgets/painting/deform/pathdeform.cpp51
-rw-r--r--examples/widgets/painting/deform/pathdeform.h11
-rw-r--r--examples/widgets/painting/fontsampler/mainwindow.cpp28
-rw-r--r--examples/widgets/painting/fontsampler/mainwindow.h2
-rw-r--r--examples/widgets/painting/gradients/gradients.cpp22
-rw-r--r--examples/widgets/painting/gradients/gradients.h10
-rw-r--r--examples/widgets/painting/gradients/main.cpp2
-rw-r--r--examples/widgets/painting/imagecomposition/imagecomposer.cpp13
-rw-r--r--examples/widgets/painting/imagecomposition/imagecomposer.h2
-rw-r--r--examples/widgets/painting/imagecomposition/main.cpp4
-rw-r--r--examples/widgets/painting/painterpaths/main.cpp4
-rw-r--r--examples/widgets/painting/painterpaths/renderarea.cpp7
-rw-r--r--examples/widgets/painting/painterpaths/renderarea.h2
-rw-r--r--examples/widgets/painting/painterpaths/window.cpp39
-rw-r--r--examples/widgets/painting/painterpaths/window.h2
-rw-r--r--examples/widgets/painting/pathstroke/main.cpp1
-rw-r--r--examples/widgets/painting/pathstroke/pathstroke.cpp135
-rw-r--r--examples/widgets/painting/pathstroke/pathstroke.h4
-rw-r--r--examples/widgets/painting/transformations/renderarea.cpp5
-rw-r--r--examples/widgets/painting/transformations/renderarea.h3
-rw-r--r--examples/widgets/painting/transformations/window.cpp8
-rw-r--r--examples/widgets/painting/transformations/window.h4
37 files changed, 218 insertions, 264 deletions
diff --git a/examples/widgets/painting/affine/xform.h b/examples/widgets/painting/affine/xform.h
index a0d322c0bc..fff92733a0 100644
--- a/examples/widgets/painting/affine/xform.h
+++ b/examples/widgets/painting/affine/xform.h
@@ -48,7 +48,10 @@
#include <QPolygonF>
class HoverPoints;
-QT_FORWARD_DECLARE_CLASS(QLineEdit)
+
+QT_BEGIN_NAMESPACE
+class QLineEdit;
+QT_END_NAMESPACE
class XFormView : public ArthurFrame
{
diff --git a/examples/widgets/painting/basicdrawing/main.cpp b/examples/widgets/painting/basicdrawing/main.cpp
index 9c7fef712f..f568b907de 100644
--- a/examples/widgets/painting/basicdrawing/main.cpp
+++ b/examples/widgets/painting/basicdrawing/main.cpp
@@ -38,10 +38,10 @@
**
****************************************************************************/
-#include <QApplication>
-
#include "window.h"
+#include <QApplication>
+
int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(basicdrawing);
diff --git a/examples/widgets/painting/basicdrawing/renderarea.cpp b/examples/widgets/painting/basicdrawing/renderarea.cpp
index 283ffc8349..f8a9cb7b58 100644
--- a/examples/widgets/painting/basicdrawing/renderarea.cpp
+++ b/examples/widgets/painting/basicdrawing/renderarea.cpp
@@ -38,10 +38,10 @@
**
****************************************************************************/
-#include <QtWidgets>
-
#include "renderarea.h"
+#include <QPainter>
+
//! [0]
RenderArea::RenderArea(QWidget *parent)
: QWidget(parent)
diff --git a/examples/widgets/painting/basicdrawing/renderarea.h b/examples/widgets/painting/basicdrawing/renderarea.h
index 67c5a92cf5..775ef62588 100644
--- a/examples/widgets/painting/basicdrawing/renderarea.h
+++ b/examples/widgets/painting/basicdrawing/renderarea.h
@@ -80,4 +80,4 @@ private:
};
//! [0]
-#endif
+#endif // RENDERAREA_H
diff --git a/examples/widgets/painting/basicdrawing/window.cpp b/examples/widgets/painting/basicdrawing/window.cpp
index bf01e57b7f..1690ce348b 100644
--- a/examples/widgets/painting/basicdrawing/window.cpp
+++ b/examples/widgets/painting/basicdrawing/window.cpp
@@ -38,11 +38,11 @@
**
****************************************************************************/
-#include <QtWidgets>
-
#include "renderarea.h"
#include "window.h"
+#include <QtWidgets>
+
//! [0]
const int IdRole = Qt::UserRole;
//! [0]
diff --git a/examples/widgets/painting/basicdrawing/window.h b/examples/widgets/painting/basicdrawing/window.h
index c82860051a..8b1f3e62ff 100644
--- a/examples/widgets/painting/basicdrawing/window.h
+++ b/examples/widgets/painting/basicdrawing/window.h
@@ -84,4 +84,4 @@ private:
};
//! [0]
-#endif
+#endif // WINDOW_H
diff --git a/examples/widgets/painting/composition/composition.cpp b/examples/widgets/painting/composition/composition.cpp
index fb502bc17d..6759ecc196 100644
--- a/examples/widgets/painting/composition/composition.cpp
+++ b/examples/widgets/painting/composition/composition.cpp
@@ -162,31 +162,31 @@ CompositionWidget::CompositionWidget(QWidget *parent)
#endif
QGridLayout *modesLayout = new QGridLayout(modesGroup);
- modesLayout->addWidget(rbClear, 0, 0);
- modesLayout->addWidget(rbSource, 1, 0);
- modesLayout->addWidget(rbDest, 2, 0);
- modesLayout->addWidget(rbSourceOver, 3, 0);
- modesLayout->addWidget(rbDestOver, 4, 0);
- modesLayout->addWidget(rbSourceIn, 5, 0);
- modesLayout->addWidget(rbDestIn, 6, 0);
- modesLayout->addWidget(rbSourceOut, 7, 0);
- modesLayout->addWidget(rbDestOut, 8, 0);
- modesLayout->addWidget(rbSourceAtop, 9, 0);
- modesLayout->addWidget(rbDestAtop, 10, 0);
- modesLayout->addWidget(rbXor, 11, 0);
-
- modesLayout->addWidget(rbPlus, 0, 1);
- modesLayout->addWidget(rbMultiply, 1, 1);
- modesLayout->addWidget(rbScreen, 2, 1);
- modesLayout->addWidget(rbOverlay, 3, 1);
- modesLayout->addWidget(rbDarken, 4, 1);
- modesLayout->addWidget(rbLighten, 5, 1);
- modesLayout->addWidget(rbColorDodge, 6, 1);
- modesLayout->addWidget(rbColorBurn, 7, 1);
- modesLayout->addWidget(rbHardLight, 8, 1);
- modesLayout->addWidget(rbSoftLight, 9, 1);
- modesLayout->addWidget(rbDifference, 10, 1);
- modesLayout->addWidget(rbExclusion, 11, 1);
+ modesLayout->addWidget(rbClear, 0, 0);
+ modesLayout->addWidget(rbSource, 1, 0);
+ modesLayout->addWidget(rbDest, 2, 0);
+ modesLayout->addWidget(rbSourceOver, 3, 0);
+ modesLayout->addWidget(rbDestOver, 4, 0);
+ modesLayout->addWidget(rbSourceIn, 5, 0);
+ modesLayout->addWidget(rbDestIn, 6, 0);
+ modesLayout->addWidget(rbSourceOut, 7, 0);
+ modesLayout->addWidget(rbDestOut, 8, 0);
+ modesLayout->addWidget(rbSourceAtop, 9, 0);
+ modesLayout->addWidget(rbDestAtop, 10, 0);
+ modesLayout->addWidget(rbXor, 11, 0);
+
+ modesLayout->addWidget(rbPlus, 0, 1);
+ modesLayout->addWidget(rbMultiply, 1, 1);
+ modesLayout->addWidget(rbScreen, 2, 1);
+ modesLayout->addWidget(rbOverlay, 3, 1);
+ modesLayout->addWidget(rbDarken, 4, 1);
+ modesLayout->addWidget(rbLighten, 5, 1);
+ modesLayout->addWidget(rbColorDodge, 6, 1);
+ modesLayout->addWidget(rbColorBurn, 7, 1);
+ modesLayout->addWidget(rbHardLight, 8, 1);
+ modesLayout->addWidget(rbSoftLight, 9, 1);
+ modesLayout->addWidget(rbDifference, 10, 1);
+ modesLayout->addWidget(rbExclusion, 11, 1);
QVBoxLayout *circleColorLayout = new QVBoxLayout(circleColorGroup);
@@ -345,12 +345,10 @@ void CompositionRenderer::paint(QPainter *painter)
if (usesOpenGL()) {
int new_pbuf_size = m_pbuffer_size;
- if (size().width() > m_pbuffer_size ||
- size().height() > m_pbuffer_size)
+ if (size().width() > m_pbuffer_size || size().height() > m_pbuffer_size)
new_pbuf_size *= 2;
- if (size().width() < m_pbuffer_size/2 &&
- size().height() < m_pbuffer_size/2)
+ if (size().width() < m_pbuffer_size/2 && size().height() < m_pbuffer_size/2)
new_pbuf_size /= 2;
if (!m_pbuffer || new_pbuf_size != m_pbuffer_size) {
@@ -488,7 +486,8 @@ void CompositionRenderer::mousePressEvent(QMouseEvent *e)
void CompositionRenderer::mouseMoveEvent(QMouseEvent *e)
{
- if (m_current_object == Circle) setCirclePos(e->pos() + m_offset);
+ if (m_current_object == Circle)
+ setCirclePos(e->pos() + m_offset);
}
void CompositionRenderer::mouseReleaseEvent(QMouseEvent *)
@@ -513,10 +512,11 @@ void CompositionRenderer::setCirclePos(const QPointF &pos)
m_circle_pos = pos;
const QRect newRect = rectangle_around(m_circle_pos).toAlignedRect();
#if defined(QT_OPENGL_SUPPORT) && !defined(QT_OPENGL_ES)
- if (usesOpenGL())
+ if (usesOpenGL()) {
update();
- else
+ return;
+ }
#endif
- update(oldRect | newRect);
+ update(oldRect | newRect);
}
diff --git a/examples/widgets/painting/composition/composition.h b/examples/widgets/painting/composition/composition.h
index 8090d5034c..d51e0672eb 100644
--- a/examples/widgets/painting/composition/composition.h
+++ b/examples/widgets/painting/composition/composition.h
@@ -47,8 +47,10 @@
#include <QPainter>
#include <QEvent>
-QT_FORWARD_DECLARE_CLASS(QPushButton)
-QT_FORWARD_DECLARE_CLASS(QRadioButton)
+QT_BEGIN_NAMESPACE
+class QPushButton;
+class QRadioButton;
+QT_END_NAMESPACE
#ifdef QT_OPENGL_SUPPORT
#include <QtOpenGL>
diff --git a/examples/widgets/painting/composition/main.cpp b/examples/widgets/painting/composition/main.cpp
index 8d5499017b..2e20204630 100644
--- a/examples/widgets/painting/composition/main.cpp
+++ b/examples/widgets/painting/composition/main.cpp
@@ -46,7 +46,7 @@
#include <QtOpenGL>
#endif
-int main(int argc, char **argv)
+int main(int argc, char *argv[])
{
// Q_INIT_RESOURCE(deform);
diff --git a/examples/widgets/painting/concentriccircles/circlewidget.cpp b/examples/widgets/painting/concentriccircles/circlewidget.cpp
index 8fd134999b..34391f1b51 100644
--- a/examples/widgets/painting/concentriccircles/circlewidget.cpp
+++ b/examples/widgets/painting/concentriccircles/circlewidget.cpp
@@ -38,10 +38,10 @@
**
****************************************************************************/
-#include <QtWidgets>
-
#include "circlewidget.h"
+#include <QPainter>
+
#include <stdlib.h>
//! [0]
@@ -111,13 +111,10 @@ void CircleWidget::paintEvent(QPaintEvent *)
if (alpha > 0) {
painter.setPen(QPen(QColor(0, diameter / 2, 127, alpha), 3));
- if (floatBased) {
- painter.drawEllipse(QRectF(-diameter / 2.0, -diameter / 2.0,
- diameter, diameter));
- } else {
- painter.drawEllipse(QRect(-diameter / 2, -diameter / 2,
- diameter, diameter));
- }
+ if (floatBased)
+ painter.drawEllipse(QRectF(-diameter / 2.0, -diameter / 2.0, diameter, diameter));
+ else
+ painter.drawEllipse(QRect(-diameter / 2, -diameter / 2, diameter, diameter));
}
}
}
diff --git a/examples/widgets/painting/concentriccircles/circlewidget.h b/examples/widgets/painting/concentriccircles/circlewidget.h
index f9d30a3cea..f2331ec49f 100644
--- a/examples/widgets/painting/concentriccircles/circlewidget.h
+++ b/examples/widgets/painting/concentriccircles/circlewidget.h
@@ -70,4 +70,4 @@ private:
};
//! [0]
-#endif
+#endif // CIRCLEWIDGET_H
diff --git a/examples/widgets/painting/concentriccircles/main.cpp b/examples/widgets/painting/concentriccircles/main.cpp
index a244f67d66..903795685f 100644
--- a/examples/widgets/painting/concentriccircles/main.cpp
+++ b/examples/widgets/painting/concentriccircles/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/concentriccircles/window.cpp b/examples/widgets/painting/concentriccircles/window.cpp
index 9fd43f2b10..5f63a0984d 100644
--- a/examples/widgets/painting/concentriccircles/window.cpp
+++ b/examples/widgets/painting/concentriccircles/window.cpp
@@ -38,11 +38,11 @@
**
****************************************************************************/
-#include <QtWidgets>
-
#include "circlewidget.h"
#include "window.h"
+#include <QtWidgets>
+
//! [0]
Window::Window()
{
diff --git a/examples/widgets/painting/concentriccircles/window.h b/examples/widgets/painting/concentriccircles/window.h
index b5741c60fa..3e00d489e5 100644
--- a/examples/widgets/painting/concentriccircles/window.h
+++ b/examples/widgets/painting/concentriccircles/window.h
@@ -67,4 +67,4 @@ private:
};
//! [0]
-#endif
+#endif // WINDOW_H
diff --git a/examples/widgets/painting/deform/main.cpp b/examples/widgets/painting/deform/main.cpp
index 370afd7438..8c8b3d24f6 100644
--- a/examples/widgets/painting/deform/main.cpp
+++ b/examples/widgets/painting/deform/main.cpp
@@ -42,7 +42,6 @@
#include "pathdeform.h"
#include <QApplication>
-#include <QDebug>
int main(int argc, char **argv)
{
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));
}
}
diff --git a/examples/widgets/painting/deform/pathdeform.h b/examples/widgets/painting/deform/pathdeform.h
index 8e44c4ac4f..8bb2c9667c 100644
--- a/examples/widgets/painting/deform/pathdeform.h
+++ b/examples/widgets/painting/deform/pathdeform.h
@@ -44,9 +44,9 @@
#include "arthurwidgets.h"
-#include <QPainterPath>
#include <QBasicTimer>
#include <QDateTime>
+#include <QPainterPath>
class PathDeformRenderer : public ArthurFrame
{
@@ -113,8 +113,8 @@ private:
QPointF m_offset;
QPointF m_direction;
QPointF m_mousePress;
- bool m_mouseDrag;
- bool m_smallScreen;
+ bool m_mouseDrag;
+ bool m_smallScreen;
};
class PathDeformControls : public QWidget
@@ -129,9 +129,6 @@ private:
PathDeformRenderer* m_renderer;
void layoutForDesktop();
void layoutForSmallScreen();
-private slots:
- void emitQuitSignal();
- void emitOkSignal();
};
class PathDeformWidget : public QWidget
@@ -139,7 +136,7 @@ class PathDeformWidget : public QWidget
Q_OBJECT
public:
PathDeformWidget(QWidget *parent, bool smallScreen);
- void setStyle ( QStyle * style );
+ void setStyle (QStyle * style );
private:
PathDeformRenderer *m_renderer;
diff --git a/examples/widgets/painting/fontsampler/mainwindow.cpp b/examples/widgets/painting/fontsampler/mainwindow.cpp
index 42253bd4ae..479c9bac05 100644
--- a/examples/widgets/painting/fontsampler/mainwindow.cpp
+++ b/examples/widgets/painting/fontsampler/mainwindow.cpp
@@ -52,7 +52,6 @@ MainWindow::MainWindow(QWidget *parent)
{
setupUi(this);
-
sampleSizes << 32 << 24 << 16 << 14 << 12 << 8 << 4 << 2 << 1;
markedCount = 0;
setupFontTree();
@@ -86,10 +85,8 @@ void MainWindow::setupFontTree()
QTreeWidgetItem *styleItem = new QTreeWidgetItem(familyItem);
styleItem->setText(0, style);
styleItem->setCheckState(0, Qt::Unchecked);
- styleItem->setData(0, Qt::UserRole,
- QVariant(database.weight(family, style)));
- styleItem->setData(0, Qt::UserRole + 1,
- QVariant(database.italic(family, style)));
+ styleItem->setData(0, Qt::UserRole, QVariant(database.weight(family, style)));
+ styleItem->setData(0, Qt::UserRole + 1, QVariant(database.italic(family, style)));
}
}
}
@@ -177,13 +174,11 @@ void MainWindow::updateStyles(QTreeWidgetItem *item, int column)
else
--markedCount;
- if (state == Qt::Checked &&
- parent->checkState(0) == Qt::Unchecked) {
+ if (state == Qt::Checked && parent->checkState(0) == Qt::Unchecked) {
// Mark parent items when child items are checked.
parent->setCheckState(0, Qt::Checked);
- } else if (state == Qt::Unchecked &&
- parent->checkState(0) == Qt::Checked) {
+ } else if (state == Qt::Unchecked && parent->checkState(0) == Qt::Checked) {
bool marked = false;
for (int row = 0; row < parent->childCount(); ++row) {
@@ -343,16 +338,16 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
qreal scale = qMin(xScale, yScale);
qreal remainingHeight = printer->pageRect().height()/scale - height;
- qreal spaceHeight = (remainingHeight/4.0) / (items.count() + 1);
- qreal interLineHeight = (remainingHeight/4.0) / (sampleSizes.count() * items.count());
+ qreal spaceHeight = (remainingHeight / 4.0) / (items.count() + 1);
+ qreal interLineHeight = (remainingHeight / 4.0) / (sampleSizes.count() * items.count());
painter->save();
- painter->translate(printer->pageRect().width()/2.0, printer->pageRect().height()/2.0);
+ painter->translate(printer->pageRect().width() / 2.0, printer->pageRect().height() / 2.0);
painter->scale(scale, scale);
painter->setBrush(QBrush(Qt::black));
- qreal x = -width/2.0;
- qreal y = -height/2.0 - remainingHeight/4.0 + spaceHeight;
+ qreal x = -width / 2.0;
+ qreal y = -height / 2.0 - remainingHeight / 4.0 + spaceHeight;
foreach (QTreeWidgetItem *item, items) {
QString style = item->text(0);
@@ -368,8 +363,7 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
font.family()).arg(style));
y += rect.height();
painter->setFont(font);
- painter->drawText(QPointF(x, y),
- QString("%1 %2").arg(family).arg(style));
+ painter->drawText(QPointF(x, y), QString("%1 %2").arg(family).arg(style));
y += interLineHeight;
}
y += spaceHeight;
@@ -377,4 +371,4 @@ void MainWindow::printPage(int index, QPainter *painter, QPrinter *printer)
painter->restore();
}
-#endif
+#endif // QT_NO_PRINTER
diff --git a/examples/widgets/painting/fontsampler/mainwindow.h b/examples/widgets/painting/fontsampler/mainwindow.h
index 7ac5692eb6..d80f174606 100644
--- a/examples/widgets/painting/fontsampler/mainwindow.h
+++ b/examples/widgets/painting/fontsampler/mainwindow.h
@@ -84,4 +84,4 @@ private:
int markedCount;
};
-#endif
+#endif // MAINWINDOW_H
diff --git a/examples/widgets/painting/gradients/gradients.cpp b/examples/widgets/painting/gradients/gradients.cpp
index 1474c4ffaf..09985df8fa 100644
--- a/examples/widgets/painting/gradients/gradients.cpp
+++ b/examples/widgets/painting/gradients/gradients.cpp
@@ -62,7 +62,6 @@ ShadeWidget::ShadeWidget(ShadeType type, QWidget *parent)
} else {
setAttribute(Qt::WA_NoBackground);
-
}
QPolygonF points;
@@ -81,13 +80,11 @@ ShadeWidget::ShadeWidget(ShadeType type, QWidget *parent)
connect(m_hoverPoints, SIGNAL(pointsChanged(QPolygonF)), this, SIGNAL(colorsChanged()));
}
-
QPolygonF ShadeWidget::points() const
{
return m_hoverPoints->points();
}
-
uint ShadeWidget::colorAt(int x)
{
generateShade();
@@ -104,7 +101,6 @@ uint ShadeWidget::colorAt(int x)
return 0;
}
-
void ShadeWidget::setGradientStops(const QGradientStops &stops)
{
if (m_shade_type == ARGBShade) {
@@ -121,7 +117,6 @@ void ShadeWidget::setGradientStops(const QGradientStops &stops)
}
}
-
void ShadeWidget::paintEvent(QPaintEvent *)
{
generateShade();
@@ -133,7 +128,6 @@ void ShadeWidget::paintEvent(QPaintEvent *)
p.drawRect(0, 0, width() - 1, height() - 1);
}
-
void ShadeWidget::generateShade()
{
if (m_shade.isNull() || m_shade.size() != size()) {
@@ -167,11 +161,8 @@ void ShadeWidget::generateShade()
p.fillRect(rect(), shade);
}
}
-
-
}
-
GradientEditor::GradientEditor(QWidget *parent)
: QWidget(parent)
{
@@ -195,13 +186,11 @@ GradientEditor::GradientEditor(QWidget *parent)
connect(m_alpha_shade, SIGNAL(colorsChanged()), this, SLOT(pointsUpdated()));
}
-
inline static bool x_less_than(const QPointF &p1, const QPointF &p2)
{
return p1.x() < p2.x();
}
-
void GradientEditor::pointsUpdated()
{
qreal w = m_alpha_shade->width();
@@ -217,9 +206,9 @@ void GradientEditor::pointsUpdated()
qSort(points.begin(), points.end(), x_less_than);
- for (int i=0; i<points.size(); ++i) {
+ for (int i = 0; i < points.size(); ++i) {
qreal x = int(points.at(i).x());
- if (i+1 < points.size() && x == points.at(i+1).x())
+ if (i + 1 < points.size() && x == points.at(i + 1).x())
continue;
QColor color((0x00ff0000 & m_red_shade->colorAt(int(x))) >> 16,
(0x0000ff00 & m_green_shade->colorAt(int(x))) >> 8,
@@ -237,7 +226,6 @@ void GradientEditor::pointsUpdated()
emit gradientStopsChanged(stops);
}
-
static void set_shade_points(const QPolygonF &points, ShadeWidget *shade)
{
shade->hoverPoints()->setPoints(points);
@@ -255,7 +243,7 @@ void GradientEditor::setGradientStops(const QGradientStops &stops)
qreal h_blue = m_blue_shade->height();
qreal h_alpha = m_alpha_shade->height();
- for (int i=0; i<stops.size(); ++i) {
+ for (int i = 0; i < stops.size(); ++i) {
qreal pos = stops.at(i).first;
QRgb color = stops.at(i).second.rgba();
pts_red << QPointF(pos * m_red_shade->width(), h_red - qRed(color) * h_red / 255);
@@ -454,7 +442,6 @@ void GradientWidget::setDefault(int config)
m_renderer->setGradientStops(stops);
}
-
GradientRenderer::GradientRenderer(QWidget *parent)
: ArthurFrame(parent)
{
@@ -477,7 +464,6 @@ void GradientRenderer::setGradientStops(const QGradientStops &stops)
update();
}
-
void GradientRenderer::mousePressEvent(QMouseEvent *)
{
setDescriptionEnabled(false);
@@ -503,7 +489,7 @@ void GradientRenderer::paint(QPainter *p)
g = QConicalGradient(pts.at(0), angle);
}
- for (int i=0; i<m_stops.size(); ++i)
+ for (int i = 0; i < m_stops.size(); ++i)
g.setColorAt(m_stops.at(i).first, m_stops.at(i).second);
g.setSpread(m_spread);
diff --git a/examples/widgets/painting/gradients/gradients.h b/examples/widgets/painting/gradients/gradients.h
index 0881d864f3..c816bddd0b 100644
--- a/examples/widgets/painting/gradients/gradients.h
+++ b/examples/widgets/painting/gradients/gradients.h
@@ -44,7 +44,9 @@
#include "arthurwidgets.h"
-#include <QtWidgets>
+QT_BEGIN_NAMESPACE
+class QRadioButton;
+QT_END_NAMESPACE
class HoverPoints;
@@ -52,6 +54,7 @@ class HoverPoints;
class ShadeWidget : public QWidget
{
Q_OBJECT
+
public:
enum ShadeType {
RedShade,
@@ -88,6 +91,7 @@ private:
class GradientEditor : public QWidget
{
Q_OBJECT
+
public:
GradientEditor(QWidget *parent);
@@ -106,10 +110,10 @@ private:
ShadeWidget *m_alpha_shade;
};
-
class GradientRenderer : public ArthurFrame
{
Q_OBJECT
+
public:
GradientRenderer(QWidget *parent);
void paint(QPainter *p);
@@ -139,10 +143,10 @@ private:
Qt::BrushStyle m_gradientType;
};
-
class GradientWidget : public QWidget
{
Q_OBJECT
+
public:
GradientWidget(QWidget *parent);
diff --git a/examples/widgets/painting/gradients/main.cpp b/examples/widgets/painting/gradients/main.cpp
index ce179a7312..6ffba86acc 100644
--- a/examples/widgets/painting/gradients/main.cpp
+++ b/examples/widgets/painting/gradients/main.cpp
@@ -43,7 +43,7 @@
#include <QApplication>
-int main(int argc, char **argv)
+int main(int argc, char *argv[])
{
Q_INIT_RESOURCE(gradients);
diff --git a/examples/widgets/painting/imagecomposition/imagecomposer.cpp b/examples/widgets/painting/imagecomposition/imagecomposer.cpp
index cc1954d1de..e520cd871a 100644
--- a/examples/widgets/painting/imagecomposition/imagecomposer.cpp
+++ b/examples/widgets/painting/imagecomposition/imagecomposer.cpp
@@ -38,10 +38,10 @@
**
****************************************************************************/
-#include <QtWidgets>
-
#include "imagecomposer.h"
+#include <QtWidgets>
+
//! [0]
static const QSize resultSize(200, 200);
//! [0]
@@ -91,10 +91,8 @@ ImageComposer::ImageComposer()
//! [3]
connect(sourceButton, SIGNAL(clicked()), this, SLOT(chooseSource()));
- connect(operatorComboBox, SIGNAL(activated(int)),
- this, SLOT(recalculateResult()));
- connect(destinationButton, SIGNAL(clicked()),
- this, SLOT(chooseDestination()));
+ connect(operatorComboBox, SIGNAL(activated(int)), this, SLOT(recalculateResult()));
+ connect(destinationButton, SIGNAL(clicked()), this, SLOT(chooseDestination()));
//! [3]
//! [4]
@@ -128,8 +126,7 @@ void ImageComposer::chooseSource()
//! [7]
void ImageComposer::chooseDestination()
{
- chooseImage(tr("Choose Destination Image"), &destinationImage,
- destinationButton);
+ chooseImage(tr("Choose Destination Image"), &destinationImage, destinationButton);
}
//! [7]
diff --git a/examples/widgets/painting/imagecomposition/imagecomposer.h b/examples/widgets/painting/imagecomposition/imagecomposer.h
index 6f9d875938..ae2fa9f168 100644
--- a/examples/widgets/painting/imagecomposition/imagecomposer.h
+++ b/examples/widgets/painting/imagecomposition/imagecomposer.h
@@ -84,4 +84,4 @@ private:
};
//! [1]
-#endif
+#endif // IMAGECOMPOSER_H
diff --git a/examples/widgets/painting/imagecomposition/main.cpp b/examples/widgets/painting/imagecomposition/main.cpp
index 29ae0cd74c..3e0d509d17 100644
--- a/examples/widgets/painting/imagecomposition/main.cpp
+++ b/examples/widgets/painting/imagecomposition/main.cpp
@@ -38,10 +38,10 @@
**
****************************************************************************/
-#include <QApplication>
-
#include "imagecomposer.h"
+#include <QApplication>
+
//! [0]
int main(int argc, char *argv[])
{
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
diff --git a/examples/widgets/painting/pathstroke/main.cpp b/examples/widgets/painting/pathstroke/main.cpp
index 959202b6f6..8e1c263320 100644
--- a/examples/widgets/painting/pathstroke/main.cpp
+++ b/examples/widgets/painting/pathstroke/main.cpp
@@ -40,6 +40,7 @@
****************************************************************************/
#include "pathstroke.h"
+
#include <QApplication>
int main(int argc, char **argv)
diff --git a/examples/widgets/painting/pathstroke/pathstroke.cpp b/examples/widgets/painting/pathstroke/pathstroke.cpp
index 4b71991d04..c11c1e8160 100644
--- a/examples/widgets/painting/pathstroke/pathstroke.cpp
+++ b/examples/widgets/painting/pathstroke/pathstroke.cpp
@@ -39,9 +39,9 @@
**
****************************************************************************/
-#include "pathstroke.h"
#include "arthurstyle.h"
#include "arthurwidgets.h"
+#include "pathstroke.h"
#include <stdio.h>
@@ -236,11 +236,9 @@ void PathStrokeControls::layoutForDesktop()
// Set up connections
- connect(animated, SIGNAL(toggled(bool)),
- m_renderer, SLOT(setAnimation(bool)));
+ connect(animated, SIGNAL(toggled(bool)), m_renderer, SLOT(setAnimation(bool)));
- connect(penWidth, SIGNAL(valueChanged(int)),
- m_renderer, SLOT(setPenWidth(int)));
+ connect(penWidth, SIGNAL(valueChanged(int)), m_renderer, SLOT(setPenWidth(int)));
connect(showSourceButton, SIGNAL(clicked()), m_renderer, SLOT(showSource()));
#ifdef QT_OPENGL_SUPPORT
@@ -332,10 +330,14 @@ void PathStrokeControls::layoutForSmallScreens()
}
void PathStrokeControls::emitQuitSignal()
-{ emit quitPressed(); }
+{
+ emit quitPressed();
+}
void PathStrokeControls::emitOkSignal()
-{ emit okPressed(); }
+{
+ emit okPressed();
+}
PathStrokeWidget::PathStrokeWidget(bool smallScreen)
@@ -362,19 +364,16 @@ PathStrokeWidget::PathStrokeWidget(bool smallScreen)
connect(m_controls, SIGNAL(quitPressed()), QApplication::instance(), SLOT(quit()));
}
-
void PathStrokeWidget::showControls()
{
m_controls->showFullScreen();
}
-
void PathStrokeWidget::hideControls()
{
m_controls->hide();
}
-
void PathStrokeWidget::setStyle( QStyle * style )
{
QWidget::setStyle(style);
@@ -388,7 +387,6 @@ void PathStrokeWidget::setStyle( QStyle * style )
}
}
-
PathStrokeRenderer::PathStrokeRenderer(QWidget *parent, bool smallScreen)
: ArthurFrame(parent)
{
@@ -420,9 +418,8 @@ void PathStrokeRenderer::paint(QPainter *painter)
path.moveTo(m_points.at(0));
if (m_pathMode == LineMode) {
- for (int i=1; i<m_points.size(); ++i) {
+ for (int i=1; i<m_points.size(); ++i)
path.lineTo(m_points.at(i));
- }
} else {
int i=1;
while (i + 2 < m_points.size()) {
@@ -595,67 +592,67 @@ bool PathStrokeRenderer::event(QEvent *e)
case QEvent::TouchBegin:
touchBegin = true;
case QEvent::TouchUpdate:
- {
- const QTouchEvent *const event = static_cast<const QTouchEvent*>(e);
- const QList<QTouchEvent::TouchPoint> points = event->touchPoints();
- foreach (const QTouchEvent::TouchPoint &touchPoint, points) {
- const int id = touchPoint.id();
- switch (touchPoint.state()) {
- case Qt::TouchPointPressed:
- {
- // find the point, move it
- QSet<int> activePoints = QSet<int>::fromList(m_fingerPointMapping.values());
- int activePoint = -1;
- qreal distance = -1;
- const int pointsCount = m_points.size();
- for (int i=0; i<pointsCount; ++i) {
- if (activePoints.contains(i))
- continue;
-
- qreal d = QLineF(touchPoint.pos(), m_points.at(i)).length();
- if ((distance < 0 && d < 12 * m_pointSize) || d < distance) {
- distance = d;
- activePoint = i;
- }
- }
- if (activePoint != -1) {
- m_fingerPointMapping.insert(touchPoint.id(), activePoint);
- m_points[activePoint] = touchPoint.pos();
- }
- }
- break;
- case Qt::TouchPointReleased:
- {
- // move the point and release
- QHash<int,int>::iterator it = m_fingerPointMapping.find(id);
- m_points[it.value()] = touchPoint.pos();
- m_fingerPointMapping.erase(it);
- }
- break;
- case Qt::TouchPointMoved:
- {
- // move the point
- const int pointIdx = m_fingerPointMapping.value(id, -1);
- if (pointIdx >= 0)
- m_points[pointIdx] = touchPoint.pos();
+ {
+ const QTouchEvent *const event = static_cast<const QTouchEvent*>(e);
+ const QList<QTouchEvent::TouchPoint> points = event->touchPoints();
+ foreach (const QTouchEvent::TouchPoint &touchPoint, points) {
+ const int id = touchPoint.id();
+ switch (touchPoint.state()) {
+ case Qt::TouchPointPressed:
+ {
+ // find the point, move it
+ QSet<int> activePoints = QSet<int>::fromList(m_fingerPointMapping.values());
+ int activePoint = -1;
+ qreal distance = -1;
+ const int pointsCount = m_points.size();
+ for (int i=0; i<pointsCount; ++i) {
+ if (activePoints.contains(i))
+ continue;
+
+ qreal d = QLineF(touchPoint.pos(), m_points.at(i)).length();
+ if ((distance < 0 && d < 12 * m_pointSize) || d < distance) {
+ distance = d;
+ activePoint = i;
}
- break;
- default:
- break;
}
- }
- if (m_fingerPointMapping.isEmpty()) {
- e->ignore();
- return false;
- } else {
- if (touchBegin) {
- m_wasAnimated = m_timer.isActive();
- setAnimation(false);
+ if (activePoint != -1) {
+ m_fingerPointMapping.insert(touchPoint.id(), activePoint);
+ m_points[activePoint] = touchPoint.pos();
}
- update();
- return true;
+ break;
+ }
+ case Qt::TouchPointReleased:
+ {
+ // move the point and release
+ QHash<int,int>::iterator it = m_fingerPointMapping.find(id);
+ m_points[it.value()] = touchPoint.pos();
+ m_fingerPointMapping.erase(it);
+ break;
+ }
+ case Qt::TouchPointMoved:
+ {
+ // move the point
+ const int pointIdx = m_fingerPointMapping.value(id, -1);
+ if (pointIdx >= 0)
+ m_points[pointIdx] = touchPoint.pos();
+ break;
+ }
+ default:
+ break;
}
}
+ if (m_fingerPointMapping.isEmpty()) {
+ e->ignore();
+ return false;
+ } else {
+ if (touchBegin) {
+ m_wasAnimated = m_timer.isActive();
+ setAnimation(false);
+ }
+ update();
+ return true;
+ }
+ }
break;
case QEvent::TouchEnd:
if (m_fingerPointMapping.isEmpty()) {
diff --git a/examples/widgets/painting/pathstroke/pathstroke.h b/examples/widgets/painting/pathstroke/pathstroke.h
index a4b5b2d86f..6afc271e41 100644
--- a/examples/widgets/painting/pathstroke/pathstroke.h
+++ b/examples/widgets/painting/pathstroke/pathstroke.h
@@ -43,6 +43,7 @@
#define PATHSTROKE_H
#include "arthurwidgets.h"
+
#include <QtWidgets>
class PathStrokeRenderer : public ArthurFrame
@@ -126,6 +127,7 @@ private:
class PathStrokeControls : public QWidget
{
Q_OBJECT
+
public:
PathStrokeControls(QWidget* parent, PathStrokeRenderer* renderer, bool smallScreen);
@@ -154,6 +156,7 @@ private slots:
class PathStrokeWidget : public QWidget
{
Q_OBJECT
+
public:
PathStrokeWidget(bool smallScreen);
void setStyle ( QStyle * style );
@@ -165,7 +168,6 @@ private:
private slots:
void showControls();
void hideControls();
-
};
#endif // PATHSTROKE_H
diff --git a/examples/widgets/painting/transformations/renderarea.cpp b/examples/widgets/painting/transformations/renderarea.cpp
index 7a60431d5a..21b0d55a19 100644
--- a/examples/widgets/painting/transformations/renderarea.cpp
+++ b/examples/widgets/painting/transformations/renderarea.cpp
@@ -38,10 +38,11 @@
**
****************************************************************************/
-#include <QtWidgets>
-
#include "renderarea.h"
+#include <QPainter>
+#include <QPaintEvent>
+
//! [0]
RenderArea::RenderArea(QWidget *parent)
: QWidget(parent)
diff --git a/examples/widgets/painting/transformations/renderarea.h b/examples/widgets/painting/transformations/renderarea.h
index 61becce995..e163e98ea2 100644
--- a/examples/widgets/painting/transformations/renderarea.h
+++ b/examples/widgets/painting/transformations/renderarea.h
@@ -41,7 +41,6 @@
#ifndef RENDERAREA_H
#define RENDERAREA_H
-#include <QFont>
#include <QList>
#include <QPainterPath>
#include <QRect>
@@ -87,4 +86,4 @@ private:
};
//! [2]
-#endif
+#endif // RENDERAREA_H
diff --git a/examples/widgets/painting/transformations/window.cpp b/examples/widgets/painting/transformations/window.cpp
index dbbed9fd44..beb9a3e975 100644
--- a/examples/widgets/painting/transformations/window.cpp
+++ b/examples/widgets/painting/transformations/window.cpp
@@ -38,10 +38,11 @@
**
****************************************************************************/
-#include <QtWidgets>
-
#include "window.h"
+#include <QComboBox>
+#include <QGridLayout>
+
//! [0]
Window::Window()
{
@@ -148,8 +149,7 @@ void Window::setupShapes()
shapes.append(text);
shapes.append(truck);
- connect(shapeComboBox, SIGNAL(activated(int)),
- this, SLOT(shapeSelected(int)));
+ connect(shapeComboBox, SIGNAL(activated(int)), this, SLOT(shapeSelected(int)));
}
//! [7]
diff --git a/examples/widgets/painting/transformations/window.h b/examples/widgets/painting/transformations/window.h
index 2b288446b8..36edd45b92 100644
--- a/examples/widgets/painting/transformations/window.h
+++ b/examples/widgets/painting/transformations/window.h
@@ -41,12 +41,12 @@
#ifndef WINDOW_H
#define WINDOW_H
+#include "renderarea.h"
+
#include <QList>
#include <QPainterPath>
#include <QWidget>
-#include "renderarea.h"
-
QT_BEGIN_NAMESPACE
class QComboBox;
QT_END_NAMESPACE