summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Winkelmann <Michael.winkelmann@qt.io>2017-07-14 16:09:10 +0200
committerMichael Winkelmann <Michael.winkelmann@qt.io>2017-07-18 15:34:28 +0000
commitcbcd1b0c432089777377fb0190a7d86195367bb6 (patch)
tree75b13d9f19d2cbf6592f3d028b4bc99eb76cb753
parent38eb39a8873f4341cff7165655bb6e2aed40a793 (diff)
Update examples to C++11
Change-Id: If23693387da9e5c0a102041298f626a068b26f6d Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
-rw-r--r--examples/scxml/calculator-widgets/mainwindow.h2
-rw-r--r--examples/scxml/ftpclient/ftpcontrolchannel.h2
-rw-r--r--examples/scxml/ftpclient/ftpdatachannel.h2
-rw-r--r--examples/scxml/mediaplayer-common/mainwindow.h2
-rw-r--r--examples/scxml/pinball/mainwindow.h2
-rw-r--r--examples/scxml/sudoku/mainwindow.cpp2
-rw-r--r--examples/scxml/sudoku/mainwindow.h2
-rw-r--r--examples/scxml/trafficlight-common/trafficlight.cpp7
-rw-r--r--examples/scxml/trafficlight-common/trafficlight.h16
-rw-r--r--src/scxml/doc/qtscxml-instantiating-state-machines.qdoc4
10 files changed, 20 insertions, 21 deletions
diff --git a/examples/scxml/calculator-widgets/mainwindow.h b/examples/scxml/calculator-widgets/mainwindow.h
index c8d77f3..fe34271 100644
--- a/examples/scxml/calculator-widgets/mainwindow.h
+++ b/examples/scxml/calculator-widgets/mainwindow.h
@@ -66,7 +66,7 @@ class MainWindow : public QWidget
Q_OBJECT
public:
- explicit MainWindow(QScxmlStateMachine *machine, QWidget *parent = 0);
+ explicit MainWindow(QScxmlStateMachine *machine, QWidget *parent = nullptr);
~MainWindow();
private:
diff --git a/examples/scxml/ftpclient/ftpcontrolchannel.h b/examples/scxml/ftpclient/ftpcontrolchannel.h
index ce8ad72..78a2486 100644
--- a/examples/scxml/ftpclient/ftpcontrolchannel.h
+++ b/examples/scxml/ftpclient/ftpcontrolchannel.h
@@ -59,7 +59,7 @@ class FtpControlChannel : public QObject
{
Q_OBJECT
public:
- explicit FtpControlChannel(QObject *parent = 0);
+ explicit FtpControlChannel(QObject *parent = nullptr);
// Connect to an FTP server
void connectToServer(const QString &server);
diff --git a/examples/scxml/ftpclient/ftpdatachannel.h b/examples/scxml/ftpclient/ftpdatachannel.h
index 2ca211c..097e7e7 100644
--- a/examples/scxml/ftpclient/ftpdatachannel.h
+++ b/examples/scxml/ftpclient/ftpdatachannel.h
@@ -60,7 +60,7 @@ class FtpDataChannel : public QObject
{
Q_OBJECT
public:
- explicit FtpDataChannel(QObject *parent = 0);
+ explicit FtpDataChannel(QObject *parent = nullptr);
// Listen on a local address.
void listen(const QHostAddress &address = QHostAddress::Any);
diff --git a/examples/scxml/mediaplayer-common/mainwindow.h b/examples/scxml/mediaplayer-common/mainwindow.h
index c89c269..9f26433 100644
--- a/examples/scxml/mediaplayer-common/mainwindow.h
+++ b/examples/scxml/mediaplayer-common/mainwindow.h
@@ -68,7 +68,7 @@ class MainWindow : public QWidget
Q_OBJECT
public:
- explicit MainWindow(QScxmlStateMachine *stateMachine, QWidget *parent = 0);
+ explicit MainWindow(QScxmlStateMachine *stateMachine, QWidget *parent = nullptr);
~MainWindow();
private slots:
diff --git a/examples/scxml/pinball/mainwindow.h b/examples/scxml/pinball/mainwindow.h
index 57dffe7..daceb6e 100644
--- a/examples/scxml/pinball/mainwindow.h
+++ b/examples/scxml/pinball/mainwindow.h
@@ -66,7 +66,7 @@ class MainWindow : public QWidget
Q_OBJECT
public:
- explicit MainWindow(QScxmlStateMachine *machine, QWidget *parent = 0);
+ explicit MainWindow(QScxmlStateMachine *machine, QWidget *parent = nullptr);
~MainWindow();
private:
diff --git a/examples/scxml/sudoku/mainwindow.cpp b/examples/scxml/sudoku/mainwindow.cpp
index 3a13010..7f7d99e 100644
--- a/examples/scxml/sudoku/mainwindow.cpp
+++ b/examples/scxml/sudoku/mainwindow.cpp
@@ -174,7 +174,7 @@ MainWindow::MainWindow(QScxmlStateMachine *machine, QWidget *parent) :
foreach (const QFileInfo &sudokuFile, sudokuFiles)
m_chooser->addItem(sudokuFile.completeBaseName(), sudokuFile.absoluteFilePath());
- connect(m_chooser, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),
+ connect(m_chooser, QOverload<int>::of(&QComboBox::currentIndexChanged),
[this] (int index) {
const QString sudokuFile = m_chooser->itemData(index).toString();
const QVariantMap initValues = readSudoku(sudokuFile);
diff --git a/examples/scxml/sudoku/mainwindow.h b/examples/scxml/sudoku/mainwindow.h
index 99a0f1b..b37279e 100644
--- a/examples/scxml/sudoku/mainwindow.h
+++ b/examples/scxml/sudoku/mainwindow.h
@@ -66,7 +66,7 @@ class MainWindow : public QWidget
Q_OBJECT
public:
- explicit MainWindow(QScxmlStateMachine *machine, QWidget *parent = 0);
+ explicit MainWindow(QScxmlStateMachine *machine, QWidget *parent = nullptr);
~MainWindow();
private:
diff --git a/examples/scxml/trafficlight-common/trafficlight.cpp b/examples/scxml/trafficlight-common/trafficlight.cpp
index 66ed289..8792ae2 100644
--- a/examples/scxml/trafficlight-common/trafficlight.cpp
+++ b/examples/scxml/trafficlight-common/trafficlight.cpp
@@ -55,7 +55,7 @@
class TrafficLightWidget : public QWidget
{
public:
- TrafficLightWidget(QWidget *parent = 0)
+ TrafficLightWidget(QWidget *parent = nullptr)
: QWidget(parent), m_background(QLatin1String(":/background.png"))
{
QVBoxLayout *vbox = new QVBoxLayout(this);
@@ -76,14 +76,14 @@ public:
LightWidget *greenLight() const
{ return m_green; }
- virtual void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE
+ virtual void paintEvent(QPaintEvent *) override
{
QPainter painter(this);
painter.setRenderHint(QPainter::Antialiasing);
painter.drawImage(0, 0, m_background);
}
- virtual QSize sizeHint() const Q_DECL_OVERRIDE
+ virtual QSize sizeHint() const override
{
return m_background.size();
}
@@ -133,7 +133,6 @@ void TrafficLight::toggleWorking(bool pause)
LightWidget::LightWidget(const QString &image, QWidget *parent)
: QWidget(parent)
, m_image(image)
- , m_on(false)
{}
bool LightWidget::isOn() const
diff --git a/examples/scxml/trafficlight-common/trafficlight.h b/examples/scxml/trafficlight-common/trafficlight.h
index f64feda..2639cb7 100644
--- a/examples/scxml/trafficlight-common/trafficlight.h
+++ b/examples/scxml/trafficlight-common/trafficlight.h
@@ -61,7 +61,7 @@ class TrafficLight : public QWidget
Q_OBJECT
public:
- TrafficLight(QScxmlStateMachine *machine, QWidget *parent = 0);
+ TrafficLight(QScxmlStateMachine *machine, QWidget *parent = nullptr);
private slots:
void toggleWorking(bool pause);
@@ -76,7 +76,7 @@ class LightWidget: public QWidget
Q_PROPERTY(bool on READ isOn WRITE setOn)
public:
- LightWidget(const QString &image, QWidget *parent = 0);
+ LightWidget(const QString &image, QWidget *parent = nullptr);
bool isOn() const;
void setOn(bool on);
@@ -85,23 +85,23 @@ public slots:
void switchLight(bool onoff);
protected:
- virtual void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- virtual QSize sizeHint() const Q_DECL_OVERRIDE;
+ virtual void paintEvent(QPaintEvent *) override;
+ virtual QSize sizeHint() const override;
private:
QImage m_image;
- bool m_on;
+ bool m_on = false;
};
class ButtonWidget : public QAbstractButton
{
Q_OBJECT
public:
- ButtonWidget(QWidget *parent = 0);
+ ButtonWidget(QWidget *parent = nullptr);
protected:
- virtual void paintEvent(QPaintEvent *) Q_DECL_OVERRIDE;
- virtual QSize sizeHint() const Q_DECL_OVERRIDE;
+ virtual void paintEvent(QPaintEvent *) override;
+ virtual QSize sizeHint() const override;
private:
QImage m_playIcon;
diff --git a/src/scxml/doc/qtscxml-instantiating-state-machines.qdoc b/src/scxml/doc/qtscxml-instantiating-state-machines.qdoc
index 0737dff..37cff10 100644
--- a/src/scxml/doc/qtscxml-instantiating-state-machines.qdoc
+++ b/src/scxml/doc/qtscxml-instantiating-state-machines.qdoc
@@ -146,8 +146,8 @@
\code
stateMachine->submitEvent("tap", QVariantMap({
- std::make_pair("artist", "Fatboy Slim"),
- std::make_pair("title", "The Rockafeller Skank")
+ { "artist", "Fatboy Slim" },
+ { "title", "The Rockafeller Skank" }
});
\endcode