summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2017-09-17 19:33:43 (GMT)
committerAndré Hartmann <aha_1980@gmx.de>2017-09-18 17:31:43 (GMT)
commit671233ea2b2f2903b153726f4d6358fb5673d279 (patch)
tree899ee69df546eec052ee2627e33617ae5d79a004
parent004289a1b7e5ff5c4f19fab3c3d41c009429b352 (diff)
downloadqtserialport-671233ea2b2f2903b153726f4d6358fb5673d279.tar.gz
Terminal Example: Modernizev5.10.0-beta1
* Replace Q_DECL_OVERRIDE with override * Init all POD members * Update includes to common style and remove unneded ones Task-number: QTBUG-60652 Change-Id: Ibb5c0347bd14cfc0386f39059498edd384a7200c Reviewed-by: Denis Shienkov <denis.shienkov@gmail.com>
-rw-r--r--examples/serialport/terminal/console.cpp6
-rw-r--r--examples/serialport/terminal/console.h12
-rw-r--r--examples/serialport/terminal/mainwindow.cpp1
-rw-r--r--examples/serialport/terminal/mainwindow.h15
4 files changed, 12 insertions, 22 deletions
diff --git a/examples/serialport/terminal/console.cpp b/examples/serialport/terminal/console.cpp
index 4f8d580..b0e9bcd 100644
--- a/examples/serialport/terminal/console.cpp
+++ b/examples/serialport/terminal/console.cpp
@@ -53,23 +53,19 @@
#include <QScrollBar>
-#include <QtCore/QDebug>
-
Console::Console(QWidget *parent)
: QPlainTextEdit(parent)
- , localEchoEnabled(false)
{
document()->setMaximumBlockCount(100);
QPalette p = palette();
p.setColor(QPalette::Base, Qt::black);
p.setColor(QPalette::Text, Qt::green);
setPalette(p);
-
}
void Console::putData(const QByteArray &data)
{
- insertPlainText(QString(data));
+ insertPlainText(data);
QScrollBar *bar = verticalScrollBar();
bar->setValue(bar->maximum());
diff --git a/examples/serialport/terminal/console.h b/examples/serialport/terminal/console.h
index 0674ded..0a5cd64 100644
--- a/examples/serialport/terminal/console.h
+++ b/examples/serialport/terminal/console.h
@@ -65,18 +65,16 @@ public:
explicit Console(QWidget *parent = nullptr);
void putData(const QByteArray &data);
-
void setLocalEchoEnabled(bool set);
protected:
- void keyPressEvent(QKeyEvent *e) Q_DECL_OVERRIDE;
- void mousePressEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void mouseDoubleClickEvent(QMouseEvent *e) Q_DECL_OVERRIDE;
- void contextMenuEvent(QContextMenuEvent *e) Q_DECL_OVERRIDE;
+ void keyPressEvent(QKeyEvent *e) override;
+ void mousePressEvent(QMouseEvent *e) override;
+ void mouseDoubleClickEvent(QMouseEvent *e) override;
+ void contextMenuEvent(QContextMenuEvent *e) override;
private:
- bool localEchoEnabled;
-
+ bool localEchoEnabled = false;
};
#endif // CONSOLE_H
diff --git a/examples/serialport/terminal/mainwindow.cpp b/examples/serialport/terminal/mainwindow.cpp
index f6e86cc..f4589bb 100644
--- a/examples/serialport/terminal/mainwindow.cpp
+++ b/examples/serialport/terminal/mainwindow.cpp
@@ -56,7 +56,6 @@
#include <QMessageBox>
#include <QLabel>
-#include <QtSerialPort/QSerialPort>
//! [0]
MainWindow::MainWindow(QWidget *parent) :
diff --git a/examples/serialport/terminal/mainwindow.h b/examples/serialport/terminal/mainwindow.h
index b792895..31b724b 100644
--- a/examples/serialport/terminal/mainwindow.h
+++ b/examples/serialport/terminal/mainwindow.h
@@ -52,11 +52,8 @@
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
-#include <QtCore/QtGlobal>
-
#include <QMainWindow>
-
-#include <QtSerialPort/QSerialPort>
+#include <QSerialPort>
QT_BEGIN_NAMESPACE
@@ -94,11 +91,11 @@ private:
private:
void showStatusMessage(const QString &message);
- Ui::MainWindow *ui;
- QLabel *status;
- Console *console;
- SettingsDialog *settings;
- QSerialPort *serial;
+ Ui::MainWindow *ui = nullptr;
+ QLabel *status = nullptr;
+ Console *console = nullptr;
+ SettingsDialog *settings = nullptr;
+ QSerialPort *serial = nullptr;
};
#endif // MAINWINDOW_H