summaryrefslogtreecommitdiff
path: root/examples/serialport
diff options
context:
space:
mode:
Diffstat (limited to 'examples/serialport')
-rw-r--r--examples/serialport/blockingmaster/blockingmaster.pro3
-rw-r--r--examples/serialport/blockingmaster/dialog.cpp3
-rw-r--r--examples/serialport/blockingslave/blockingslave.pro3
-rw-r--r--examples/serialport/blockingslave/dialog.cpp3
-rw-r--r--examples/serialport/cenumerator/cenumerator.pro3
-rw-r--r--examples/serialport/cenumerator/main.cpp6
-rw-r--r--examples/serialport/creaderasync/creaderasync.pro3
-rw-r--r--examples/serialport/creadersync/creadersync.pro3
-rw-r--r--examples/serialport/cwriterasync/cwriterasync.pro3
-rw-r--r--examples/serialport/cwritersync/cwritersync.pro3
-rw-r--r--examples/serialport/enumerator/enumerator.pro3
-rw-r--r--examples/serialport/enumerator/main.cpp3
-rw-r--r--examples/serialport/master/master.pro3
-rw-r--r--examples/serialport/serialport.pro3
-rw-r--r--examples/serialport/slave/slave.pro3
-rw-r--r--examples/serialport/terminal/settingsdialog.cpp3
-rw-r--r--examples/serialport/terminal/terminal.pro3
17 files changed, 45 insertions, 9 deletions
diff --git a/examples/serialport/blockingmaster/blockingmaster.pro b/examples/serialport/blockingmaster/blockingmaster.pro
index 8f3e0a1..7cf76d8 100644
--- a/examples/serialport/blockingmaster/blockingmaster.pro
+++ b/examples/serialport/blockingmaster/blockingmaster.pro
@@ -11,3 +11,6 @@ SOURCES += \
main.cpp \
dialog.cpp \
masterthread.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/serialport/blockingmaster
+INSTALLS += target
diff --git a/examples/serialport/blockingmaster/dialog.cpp b/examples/serialport/blockingmaster/dialog.cpp
index 8101424..c1ca850 100644
--- a/examples/serialport/blockingmaster/dialog.cpp
+++ b/examples/serialport/blockingmaster/dialog.cpp
@@ -74,7 +74,8 @@ Dialog::Dialog(QWidget *parent)
, statusLabel(new QLabel(tr("Status: Not running.")))
, runButton(new QPushButton(tr("Start")))
{
- foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
+ const auto infos = QSerialPortInfo::availablePorts();
+ for (const QSerialPortInfo &info : infos)
serialPortComboBox->addItem(info.portName());
waitResponseSpinBox->setRange(0, 10000);
diff --git a/examples/serialport/blockingslave/blockingslave.pro b/examples/serialport/blockingslave/blockingslave.pro
index 2477b52..11b9b80 100644
--- a/examples/serialport/blockingslave/blockingslave.pro
+++ b/examples/serialport/blockingslave/blockingslave.pro
@@ -11,3 +11,6 @@ SOURCES += \
main.cpp \
dialog.cpp \
slavethread.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/serialport/blockingslave
+INSTALLS += target
diff --git a/examples/serialport/blockingslave/dialog.cpp b/examples/serialport/blockingslave/dialog.cpp
index 3cef0cf..8550773 100644
--- a/examples/serialport/blockingslave/dialog.cpp
+++ b/examples/serialport/blockingslave/dialog.cpp
@@ -77,7 +77,8 @@ Dialog::Dialog(QWidget *parent)
waitRequestSpinBox->setRange(0, 10000);
waitRequestSpinBox->setValue(10000);
- foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts())
+ const auto infos = QSerialPortInfo::availablePorts();
+ for (const QSerialPortInfo &info : infos)
serialPortComboBox->addItem(info.portName());
QGridLayout *mainLayout = new QGridLayout;
diff --git a/examples/serialport/cenumerator/cenumerator.pro b/examples/serialport/cenumerator/cenumerator.pro
index f5494fd..75a43e3 100644
--- a/examples/serialport/cenumerator/cenumerator.pro
+++ b/examples/serialport/cenumerator/cenumerator.pro
@@ -9,3 +9,6 @@ TEMPLATE = app
SOURCES += \
main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/serialport/cenumerator
+INSTALLS += target
diff --git a/examples/serialport/cenumerator/main.cpp b/examples/serialport/cenumerator/main.cpp
index 7166b0b..f805021 100644
--- a/examples/serialport/cenumerator/main.cpp
+++ b/examples/serialport/cenumerator/main.cpp
@@ -58,16 +58,16 @@ int main(int argc, char *argv[])
{
QCoreApplication a(argc, argv);
QTextStream out(stdout);
- QList<QSerialPortInfo> serialPortInfoList = QSerialPortInfo::availablePorts();
+ const auto serialPortInfos = QSerialPortInfo::availablePorts();
- out << QObject::tr("Total number of ports available: ") << serialPortInfoList.count() << endl;
+ out << QObject::tr("Total number of ports available: ") << serialPortInfos.count() << endl;
const QString blankString = QObject::tr("N/A");
QString description;
QString manufacturer;
QString serialNumber;
- foreach (const QSerialPortInfo &serialPortInfo, serialPortInfoList) {
+ for (const QSerialPortInfo &serialPortInfo : serialPortInfos) {
description = serialPortInfo.description();
manufacturer = serialPortInfo.manufacturer();
serialNumber = serialPortInfo.serialNumber();
diff --git a/examples/serialport/creaderasync/creaderasync.pro b/examples/serialport/creaderasync/creaderasync.pro
index 3565dc9..38d8b52 100644
--- a/examples/serialport/creaderasync/creaderasync.pro
+++ b/examples/serialport/creaderasync/creaderasync.pro
@@ -13,3 +13,6 @@ HEADERS += \
SOURCES += \
main.cpp \
serialportreader.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/serialport/creaderasync
+INSTALLS += target
diff --git a/examples/serialport/creadersync/creadersync.pro b/examples/serialport/creadersync/creadersync.pro
index ee9eaf2..a2690aa 100644
--- a/examples/serialport/creadersync/creadersync.pro
+++ b/examples/serialport/creadersync/creadersync.pro
@@ -9,3 +9,6 @@ TEMPLATE = app
SOURCES += \
main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/serialport/creadersync
+INSTALLS += target
diff --git a/examples/serialport/cwriterasync/cwriterasync.pro b/examples/serialport/cwriterasync/cwriterasync.pro
index 0945f1d..f6105bc 100644
--- a/examples/serialport/cwriterasync/cwriterasync.pro
+++ b/examples/serialport/cwriterasync/cwriterasync.pro
@@ -13,3 +13,6 @@ HEADERS += \
SOURCES += \
main.cpp \
serialportwriter.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/serialport/cwriterasync
+INSTALLS += target
diff --git a/examples/serialport/cwritersync/cwritersync.pro b/examples/serialport/cwritersync/cwritersync.pro
index 08f50a2..1e0996d 100644
--- a/examples/serialport/cwritersync/cwritersync.pro
+++ b/examples/serialport/cwritersync/cwritersync.pro
@@ -9,3 +9,6 @@ TEMPLATE = app
SOURCES += \
main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/serialport/cwritersync
+INSTALLS += target
diff --git a/examples/serialport/enumerator/enumerator.pro b/examples/serialport/enumerator/enumerator.pro
index 9819fd7..3989335 100644
--- a/examples/serialport/enumerator/enumerator.pro
+++ b/examples/serialport/enumerator/enumerator.pro
@@ -5,3 +5,6 @@ TEMPLATE = app
SOURCES += \
main.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/serialport/enumerator
+INSTALLS += target
diff --git a/examples/serialport/enumerator/main.cpp b/examples/serialport/enumerator/main.cpp
index a997bf5..fa925da 100644
--- a/examples/serialport/enumerator/main.cpp
+++ b/examples/serialport/enumerator/main.cpp
@@ -64,7 +64,8 @@ int main(int argc, char *argv[])
QVBoxLayout *layout = new QVBoxLayout;
- foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
+ const auto infos = QSerialPortInfo::availablePorts();
+ for (const QSerialPortInfo &info : infos) {
QString s = QObject::tr("Port: ") + info.portName() + "\n"
+ QObject::tr("Location: ") + info.systemLocation() + "\n"
+ QObject::tr("Description: ") + info.description() + "\n"
diff --git a/examples/serialport/master/master.pro b/examples/serialport/master/master.pro
index 977de6c..354d174 100644
--- a/examples/serialport/master/master.pro
+++ b/examples/serialport/master/master.pro
@@ -13,3 +13,6 @@ HEADERS += \
SOURCES += \
main.cpp \
dialog.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/serialport/master
+INSTALLS += target
diff --git a/examples/serialport/serialport.pro b/examples/serialport/serialport.pro
index c0e77df..6d00a22 100644
--- a/examples/serialport/serialport.pro
+++ b/examples/serialport/serialport.pro
@@ -1,4 +1,3 @@
TEMPLATE = subdirs
-CONFIG += ordered
SUBDIRS = cenumerator creaderasync creadersync cwriterasync cwritersync
-!isEmpty(QT.widgets.name):SUBDIRS += enumerator terminal blockingmaster blockingslave
+!isEmpty(QT.widgets.name):SUBDIRS += enumerator terminal blockingmaster blockingslave master slave
diff --git a/examples/serialport/slave/slave.pro b/examples/serialport/slave/slave.pro
index df996ac..54e7d02 100644
--- a/examples/serialport/slave/slave.pro
+++ b/examples/serialport/slave/slave.pro
@@ -13,3 +13,6 @@ HEADERS += \
SOURCES += \
main.cpp \
dialog.cpp
+
+target.path = $$[QT_INSTALL_EXAMPLES]/serialport/slave
+INSTALLS += target
diff --git a/examples/serialport/terminal/settingsdialog.cpp b/examples/serialport/terminal/settingsdialog.cpp
index ded4b18..f9b8605 100644
--- a/examples/serialport/terminal/settingsdialog.cpp
+++ b/examples/serialport/terminal/settingsdialog.cpp
@@ -171,7 +171,8 @@ void SettingsDialog::fillPortsInfo()
QString description;
QString manufacturer;
QString serialNumber;
- foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) {
+ const auto infos = QSerialPortInfo::availablePorts();
+ for (const QSerialPortInfo &info : infos) {
QStringList list;
description = info.description();
manufacturer = info.manufacturer();
diff --git a/examples/serialport/terminal/terminal.pro b/examples/serialport/terminal/terminal.pro
index 1e45e55..4dbed02 100644
--- a/examples/serialport/terminal/terminal.pro
+++ b/examples/serialport/terminal/terminal.pro
@@ -20,3 +20,6 @@ FORMS += \
RESOURCES += \
terminal.qrc
+
+target.path = $$[QT_INSTALL_EXAMPLES]/serialport/terminal
+INSTALLS += target