summaryrefslogtreecommitdiffstats
path: root/examples/designer/customwidgetplugin/analogclock.cpp
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-01-20 18:40:42 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-01-23 16:06:41 +0000
commit159a62f184828ef36f076f2caa286e8beb67e0d4 (patch)
treeb29ab8274e85042d340555b2b0c2d5a036c96c1e /examples/designer/customwidgetplugin/analogclock.cpp
parentf7f0a12debc7d4a302937e3bc7e7eaf71eb756cf (diff)
Polish the Qt Designer examples
- Use new string literals - Reorder includes - Use some auto - Minor fixes Fixes: QTBUG-110447 Change-Id: I5af23a662dffb3a01795d1f62c573f854e2ee103 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit d1e672c47fd9cfa60f646554db6cba9de08a044f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/designer/customwidgetplugin/analogclock.cpp')
-rw-r--r--examples/designer/customwidgetplugin/analogclock.cpp17
1 files changed, 5 insertions, 12 deletions
diff --git a/examples/designer/customwidgetplugin/analogclock.cpp b/examples/designer/customwidgetplugin/analogclock.cpp
index 8d0f4e40d..23461edbf 100644
--- a/examples/designer/customwidgetplugin/analogclock.cpp
+++ b/examples/designer/customwidgetplugin/analogclock.cpp
@@ -5,6 +5,7 @@
#include <QMouseEvent>
#include <QPainter>
+
#include <QTime>
#include <QTimer>
@@ -12,7 +13,7 @@ AnalogClock::AnalogClock(QWidget *parent)
: QWidget(parent)
{
QTimer *timer = new QTimer(this);
- connect(timer, &QTimer::timeout, this, QOverload<>::of(&QWidget::update));
+ connect(timer, &QTimer::timeout, this, qOverload<>(&QWidget::update));
timer->start(1000);
setWindowTitle(tr("Analog Clock"));
@@ -21,21 +22,13 @@ AnalogClock::AnalogClock(QWidget *parent)
void AnalogClock::paintEvent(QPaintEvent *)
{
- static const QPoint hourHand[3] = {
- QPoint(7, 8),
- QPoint(-7, 8),
- QPoint(0, -40)
- };
- static const QPoint minuteHand[3] = {
- QPoint(7, 8),
- QPoint(-7, 8),
- QPoint(0, -70)
- };
+ static const QPoint hourHand[3] = {{7, 8}, {-7, 8}, {0, -40}};
+ static const QPoint minuteHand[3] = {{7, 8}, {-7, 8}, {0, -70}};
QColor hourColor(127, 0, 127);
QColor minuteColor(0, 127, 127, 191);
- int side = qMin(width(), height());
+ const int side = qMin(width(), height());
QTime time = QTime::currentTime();
QPainter painter(this);