summaryrefslogtreecommitdiffstats
path: root/examples/designer/worldtimeclockplugin
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2017-06-21 11:20:06 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-06-26 08:52:54 +0000
commit9da07cc30fdf2facaa9d4639ce6ca97509742fc4 (patch)
treeebcb356d4c970be389cf567b83ef28dfe5f596ae /examples/designer/worldtimeclockplugin
parent984efb1e87c94ef193035f6b980e57acb78dca7e (diff)
Qt Designer Examples: Brush up to C++ 11
Use nullptr, member initialization, QOverload, etc. Task-number: QTBUG-61184 Change-Id: I45061c506dad72d5f495f480b3e61f4d1c0599d4 Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Diffstat (limited to 'examples/designer/worldtimeclockplugin')
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclock.cpp6
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclock.h4
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp11
-rw-r--r--examples/designer/worldtimeclockplugin/worldtimeclockplugin.h4
4 files changed, 10 insertions, 15 deletions
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclock.cpp b/examples/designer/worldtimeclockplugin/worldtimeclock.cpp
index 158d01af5..366394287 100644
--- a/examples/designer/worldtimeclockplugin/worldtimeclock.cpp
+++ b/examples/designer/worldtimeclockplugin/worldtimeclock.cpp
@@ -56,13 +56,9 @@
WorldTimeClock::WorldTimeClock(QWidget *parent)
: QWidget(parent)
- , timeZoneOffset(0)
-
{
- typedef void (QWidget::*WidgetUpdateSlot)();
-
QTimer *timer = new QTimer(this);
- connect(timer, &QTimer::timeout, this, static_cast<WidgetUpdateSlot>(&QWidget::update));
+ connect(timer, &QTimer::timeout, this, QOverload<>::of(&QWidget::update));
timer->start(1000);
setWindowTitle(tr("World Time Clock"));
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclock.h b/examples/designer/worldtimeclockplugin/worldtimeclock.h
index faf057b09..e2d54a7e4 100644
--- a/examples/designer/worldtimeclockplugin/worldtimeclock.h
+++ b/examples/designer/worldtimeclockplugin/worldtimeclock.h
@@ -62,7 +62,7 @@ class QDESIGNER_WIDGET_EXPORT WorldTimeClock : public QWidget
//! [0]
public:
- explicit WorldTimeClock(QWidget *parent = 0);
+ explicit WorldTimeClock(QWidget *parent = nullptr);
public slots:
void setTimeZone(int hourOffset);
@@ -74,7 +74,7 @@ protected:
void paintEvent(QPaintEvent *event) override;
private:
- int timeZoneOffset;
+ int timeZoneOffset = 0;
//! [2]
};
//! [1] //! [2]
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp
index 61e6f3075..8cd059c56 100644
--- a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp
+++ b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.cpp
@@ -55,7 +55,6 @@
WorldTimeClockPlugin::WorldTimeClockPlugin(QObject *parent)
: QObject(parent)
- , initialized(false)
{
}
@@ -79,12 +78,12 @@ QWidget *WorldTimeClockPlugin::createWidget(QWidget *parent)
QString WorldTimeClockPlugin::name() const
{
- return "WorldTimeClock";
+ return QStringLiteral("WorldTimeClock");
}
QString WorldTimeClockPlugin::group() const
{
- return "Display Widgets [Examples]";
+ return QStringLiteral("Display Widgets [Examples]");
}
QIcon WorldTimeClockPlugin::icon() const
@@ -94,12 +93,12 @@ QIcon WorldTimeClockPlugin::icon() const
QString WorldTimeClockPlugin::toolTip() const
{
- return "";
+ return QString();
}
QString WorldTimeClockPlugin::whatsThis() const
{
- return "";
+ return QString();
}
bool WorldTimeClockPlugin::isContainer() const
@@ -125,5 +124,5 @@ QString WorldTimeClockPlugin::domXml() const
QString WorldTimeClockPlugin::includeFile() const
{
- return "worldtimeclock.h";
+ return QStringLiteral("worldtimeclock.h");
}
diff --git a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.h b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.h
index d1487735b..0af0b1dd0 100644
--- a/examples/designer/worldtimeclockplugin/worldtimeclockplugin.h
+++ b/examples/designer/worldtimeclockplugin/worldtimeclockplugin.h
@@ -64,7 +64,7 @@ class WorldTimeClockPlugin : public QObject,
Q_INTERFACES(QDesignerCustomWidgetInterface)
public:
- explicit WorldTimeClockPlugin(QObject *parent = 0);
+ explicit WorldTimeClockPlugin(QObject *parent = nullptr);
bool isContainer() const override;
bool isInitialized() const override;
@@ -79,7 +79,7 @@ public:
void initialize(QDesignerFormEditorInterface *core) override;
private:
- bool initialized;
+ bool initialized = false;
};
//! [0]