diff options
Diffstat (limited to 'examples')
-rw-r--r-- | examples/blockingmaster/dialog.cpp | 2 | ||||
-rw-r--r-- | examples/blockingmaster/masterthread.cpp | 12 | ||||
-rw-r--r-- | examples/blockingslave/dialog.cpp | 2 | ||||
-rw-r--r-- | examples/blockingslave/slavethread.cpp | 12 | ||||
-rw-r--r-- | examples/cenumerator/main.cpp | 4 | ||||
-rw-r--r-- | examples/doc/blockingmaster.qdoc | 16 | ||||
-rw-r--r-- | examples/doc/blockingslave.qdoc | 16 | ||||
-rw-r--r-- | examples/doc/cenumerator.qdoc | 6 | ||||
-rw-r--r-- | examples/doc/enumerator.qdoc | 6 | ||||
-rw-r--r-- | examples/doc/terminal.qdoc | 22 | ||||
-rw-r--r-- | examples/enumerator/main.cpp | 2 | ||||
-rw-r--r-- | examples/master/dialog.cpp | 12 | ||||
-rw-r--r-- | examples/master/dialog.h | 2 | ||||
-rw-r--r-- | examples/slave/dialog.cpp | 12 | ||||
-rw-r--r-- | examples/slave/dialog.h | 2 | ||||
-rw-r--r-- | examples/slave/slavethread.cpp | 12 | ||||
-rw-r--r-- | examples/terminal/mainwindow.cpp | 2 | ||||
-rw-r--r-- | examples/terminal/mainwindow.h | 4 | ||||
-rw-r--r-- | examples/terminal/settingsdialog.cpp | 50 | ||||
-rw-r--r-- | examples/terminal/settingsdialog.h | 8 |
20 files changed, 102 insertions, 102 deletions
diff --git a/examples/blockingmaster/dialog.cpp b/examples/blockingmaster/dialog.cpp index 4003401..c744ee0 100644 --- a/examples/blockingmaster/dialog.cpp +++ b/examples/blockingmaster/dialog.cpp @@ -65,7 +65,7 @@ Dialog::Dialog(QWidget *parent) , statusLabel(new QLabel(tr("Status: Not running."))) , runButton(new QPushButton(tr("Start"))) { - foreach (const SerialPortInfo &info, SerialPortInfo::availablePorts()) + foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) serialPortComboBox->addItem(info.portName()); waitResponseSpinBox->setRange(0, 10000); diff --git a/examples/blockingmaster/masterthread.cpp b/examples/blockingmaster/masterthread.cpp index 92bf6ac..6cee93b 100644 --- a/examples/blockingmaster/masterthread.cpp +++ b/examples/blockingmaster/masterthread.cpp @@ -96,7 +96,7 @@ void MasterThread::run() QString currentRequest = request; mutex.unlock(); //! [5] //! [6] - SerialPort serial; + QSerialPort serial; while (!quit) { //![6] //! [7] @@ -110,31 +110,31 @@ void MasterThread::run() return; } - if (!serial.setBaudRate(SerialPort::Baud9600)) { + if (!serial.setBaudRate(QSerialPort::Baud9600)) { emit error(tr("Can't set baud rate 9600 baud to port %1, error code %2") .arg(portName).arg(serial.error())); return; } - if (!serial.setDataBits(SerialPort::Data8)) { + if (!serial.setDataBits(QSerialPort::Data8)) { emit error(tr("Can't set 8 data bits to port %1, error code %2") .arg(portName).arg(serial.error())); return; } - if (!serial.setParity(SerialPort::NoParity)) { + if (!serial.setParity(QSerialPort::NoParity)) { emit error(tr("Can't set no patity to port %1, error code %2") .arg(portName).arg(serial.error())); return; } - if (!serial.setStopBits(SerialPort::OneStop)) { + if (!serial.setStopBits(QSerialPort::OneStop)) { emit error(tr("Can't set 1 stop bit to port %1, error code %2") .arg(portName).arg(serial.error())); return; } - if (!serial.setFlowControl(SerialPort::NoFlowControl)) { + if (!serial.setFlowControl(QSerialPort::NoFlowControl)) { emit error(tr("Can't set no flow control to port %1, error code %2") .arg(portName).arg(serial.error())); return; diff --git a/examples/blockingslave/dialog.cpp b/examples/blockingslave/dialog.cpp index b5a8118..c4f68a9 100644 --- a/examples/blockingslave/dialog.cpp +++ b/examples/blockingslave/dialog.cpp @@ -68,7 +68,7 @@ Dialog::Dialog(QWidget *parent) waitRequestSpinBox->setRange(0, 10000); waitRequestSpinBox->setValue(10000); - foreach (const SerialPortInfo &info, SerialPortInfo::availablePorts()) + foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) serialPortComboBox->addItem(info.portName()); QGridLayout *mainLayout = new QGridLayout; diff --git a/examples/blockingslave/slavethread.cpp b/examples/blockingslave/slavethread.cpp index 1aac918..1242f3c 100644 --- a/examples/blockingslave/slavethread.cpp +++ b/examples/blockingslave/slavethread.cpp @@ -92,7 +92,7 @@ void SlaveThread::run() QString currentRespone = response; mutex.unlock(); //! [5] //! [6] - SerialPort serial; + QSerialPort serial; while (!quit) { //![6] //! [7] @@ -106,31 +106,31 @@ void SlaveThread::run() return; } - if (!serial.setBaudRate(SerialPort::Baud9600)) { + if (!serial.setBaudRate(QSerialPort::Baud9600)) { emit error(tr("Can't set baud rate 9600 baud to port %1, error code %2") .arg(portName).arg(serial.error())); return; } - if (!serial.setDataBits(SerialPort::Data8)) { + if (!serial.setDataBits(QSerialPort::Data8)) { emit error(tr("Can't set 8 data bits to port %1, error code %2") .arg(portName).arg(serial.error())); return; } - if (!serial.setParity(SerialPort::NoParity)) { + if (!serial.setParity(QSerialPort::NoParity)) { emit error(tr("Can't set no patity to port %1, error code %2") .arg(portName).arg(serial.error())); return; } - if (!serial.setStopBits(SerialPort::OneStop)) { + if (!serial.setStopBits(QSerialPort::OneStop)) { emit error(tr("Can't set 1 stop bit to port %1, error code %2") .arg(portName).arg(serial.error())); return; } - if (!serial.setFlowControl(SerialPort::NoFlowControl)) { + if (!serial.setFlowControl(QSerialPort::NoFlowControl)) { emit error(tr("Can't set no flow control to port %1, error code %2") .arg(portName).arg(serial.error())); return; diff --git a/examples/cenumerator/main.cpp b/examples/cenumerator/main.cpp index 8d03c98..b8f1ef7 100644 --- a/examples/cenumerator/main.cpp +++ b/examples/cenumerator/main.cpp @@ -49,11 +49,11 @@ int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); QTextStream out(stdout); - QList<SerialPortInfo> serialPortInfoList = SerialPortInfo::availablePorts(); + QList<QSerialPortInfo> serialPortInfoList = QSerialPortInfo::availablePorts(); out << QObject::tr("Total number of ports available: ") << serialPortInfoList.count() << endl; - foreach (const SerialPortInfo &serialPortInfo, serialPortInfoList) { + foreach (const QSerialPortInfo &serialPortInfo, serialPortInfoList) { out << endl << QObject::tr("Port: ") << serialPortInfo.portName() << endl << QObject::tr("Location: ") << serialPortInfo.systemLocation() << endl diff --git a/examples/doc/blockingmaster.qdoc b/examples/doc/blockingmaster.qdoc index 4cafa40..c83d3b8 100644 --- a/examples/doc/blockingmaster.qdoc +++ b/examples/doc/blockingmaster.qdoc @@ -31,23 +31,23 @@ \example examples/blockingmaster The Blocking Master example shows how to create a application for a - serial interface using SerialPort's synchronous API in a non-GUI thread. + serial interface using QSerialPort's synchronous API in a non-GUI thread. \image blockingmaster-example.png Screenshot of the Blocking Master example - SerialPort supports two general programming approaches: + QSerialPort supports two general programming approaches: \list \o \i{The asynchronous (non-blocking) approach.} Operations are scheduled - and performed when the control returns to Qt's event loop. SerialPort emits - a signal when the operation is finished. For example, SerialPort::write() - returns immediately. When the data is sent to the serial port, SerialPort - emits \l{SerialPort::bytesWritten()}{bytesWritten()}. + and performed when the control returns to Qt's event loop. QSerialPort emits + a signal when the operation is finished. For example, QSerialPort::write() + returns immediately. When the data is sent to the serial port, QSerialPort + emits \l{QSerialPort::bytesWritten()}{bytesWritten()}. \o \i{The synchronous (blocking) approach.} In non-GUI and multithreaded applications, the \c waitFor...() functions can be called (i.e. - SerialPort::waitReadyRead()) to suspend the calling thread until the + QSerialPort::waitReadyRead()) to suspend the calling thread until the operation has completed. \endlist @@ -107,7 +107,7 @@ and timeout or request data of another. And as you might have guessed, MasterThread can only handle one request at a time. - The SerialPort object we construct on stack into run() function before loop + The QSerialPort object we construct on stack into run() function before loop enter: \snippet examples/blockingmaster/masterthread.cpp 6 diff --git a/examples/doc/blockingslave.qdoc b/examples/doc/blockingslave.qdoc index 41bb2b1..f08fa81 100644 --- a/examples/doc/blockingslave.qdoc +++ b/examples/doc/blockingslave.qdoc @@ -31,23 +31,23 @@ \example examples/blockingslave The Blocking Slave example shows how to create a application for a - serial interface using SerialPort's synchronous API in a non-GUI thread. + serial interface using QSerialPort's synchronous API in a non-GUI thread. \image blockingslave-example.png Screenshot of the Blocking Slave example - SerialPort supports two general programming approaches: + QSerialPort supports two general programming approaches: \list \o \i{The asynchronous (non-blocking) approach.} Operations are scheduled - and performed when the control returns to Qt's event loop. SerialPort emits - a signal when the operation is finished. For example, SerialPort::write() - returns immediately. When the data is sent to the serial port, SerialPort - emits \l{SerialPort::bytesWritten()}{bytesWritten()}. + and performed when the control returns to Qt's event loop. QSerialPort emits + a signal when the operation is finished. For example, QSerialPort::write() + returns immediately. When the data is sent to the serial port, QSerialPort + emits \l{QSerialPort::bytesWritten()}{bytesWritten()}. \o \i{The synchronous (blocking) approach.} In non-GUI and multithreaded applications, the \c waitFor...() functions can be called (i.e. - SerialPort::waitReadyRead()) to suspend the calling thread until the + QSerialPort::waitReadyRead()) to suspend the calling thread until the operation has completed. \endlist @@ -110,7 +110,7 @@ call and timeout or response data of another. And as you might have guessed, SlaveThread can only handle one startup at a time. - The SerialPort object we construct on stack into run() function before loop + The QSerialPort object we construct on stack into run() function before loop enter: \snippet examples/blockingslave/slavethread.cpp 6 diff --git a/examples/doc/cenumerator.qdoc b/examples/doc/cenumerator.qdoc index 1751f47..a894038 100644 --- a/examples/doc/cenumerator.qdoc +++ b/examples/doc/cenumerator.qdoc @@ -31,15 +31,15 @@ \example examples/cenumerator The Command Line Enumerator example shows how to use the class - SerialPortInfo for getting information about serial devices that are present + QSerialPortInfo for getting information about serial devices that are present in the system. \image cenumerator-example.png Screenshot of the Command Line Enumerator example This command line example displays information about serial ports in a - console, provided by the class SerialPortInfo. + console, provided by the class QSerialPortInfo. For getting information about the available ports, use the static method - \l{SerialPortInfo::availablePorts()}{availablePorts()}. + \l{QSerialPortInfo::availablePorts()}{availablePorts()}. */ diff --git a/examples/doc/enumerator.qdoc b/examples/doc/enumerator.qdoc index 4c42e55..790d2fb 100644 --- a/examples/doc/enumerator.qdoc +++ b/examples/doc/enumerator.qdoc @@ -30,14 +30,14 @@ \title Enumerator example \example examples/enumerator - The Enumerator example shows how to use the class SerialPortInfo for + The Enumerator example shows how to use the class QSerialPortInfo for getting information about serial devices that are present in the system. \image enumerator-example.png Screenshot of the Enumerator example This GUI example displays information about serial ports in a widget, - provided by the class SerialPortInfo. + provided by the class QSerialPortInfo. For getting information about the available ports, use the static method - \l{SerialPortInfo::availablePorts()}{availablePorts()}. + \l{QSerialPortInfo::availablePorts()}{availablePorts()}. */ diff --git a/examples/doc/terminal.qdoc b/examples/doc/terminal.qdoc index f87be68..090b957 100644 --- a/examples/doc/terminal.qdoc +++ b/examples/doc/terminal.qdoc @@ -31,28 +31,28 @@ \example examples/terminal The Terminal example shows how to create a terminal for a simple serial - interface by using SerialPort. + interface by using Qt Serial Port. \image terminal-example.png Screenshot of the Terminal example - This example shows the main features of the SerialPort class, like + This example shows the main features of the QSerialPort class, like configuration, I/O implementation and so forth. Also, the class - SerialPortInfo is invoked to display information about the serial ports + QSerialPortInfo is invoked to display information about the serial ports available in the system. - SerialPort supports two general programming approaches: + QSerialPort supports two general programming approaches: \list \o \i{The asynchronous (non-blocking) approach.} Operations are scheduled - and performed when the control returns to Qt's event loop. SerialPort emits - a signal when the operation is finished. For example, SerialPort::write() - returns immediately. When the data is sent to the serial port, SerialPort - emits \l{SerialPort::bytesWritten()}{bytesWritten()}. + and performed when the control returns to Qt's event loop. QSerialPort emits + a signal when the operation is finished. For example, QSerialPort::write() + returns immediately. When the data is sent to the serial port, QSerialPort + emits \l{QSerialPort::bytesWritten()}{bytesWritten()}. \o \i{The synchronous (blocking) approach.} In non-GUI and multithreaded applications, the \c waitFor...() functions can be called (i.e. - SerialPort::waitReadyRead()) to suspend the calling thread until the + QSerialPort::waitReadyRead()) to suspend the calling thread until the operation has completed. \endlist @@ -88,8 +88,8 @@ \dots \snippet examples/terminal/mainwindow.cpp 1 - The only SerialPort signal invoked in this example is - SerialPort::readyRead(), which shows that new data has been received and + The only QSerialPort signal invoked in this example is + QSerialPort::readyRead(), which shows that new data has been received and hence available: \dots diff --git a/examples/enumerator/main.cpp b/examples/enumerator/main.cpp index 6635990..c188d60 100644 --- a/examples/enumerator/main.cpp +++ b/examples/enumerator/main.cpp @@ -56,7 +56,7 @@ int main(int argc, char *argv[]) w.setWindowTitle(QObject::tr("Info about all available serial ports.")); QVBoxLayout *layout = new QVBoxLayout; - foreach (const SerialPortInfo &info, SerialPortInfo::availablePorts()) { + foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) { QString s(QObject::tr("Port: %1\n" "Location: %2\n" "Description: %3\n" diff --git a/examples/master/dialog.cpp b/examples/master/dialog.cpp index 4df45f4..36c4a8f 100644 --- a/examples/master/dialog.cpp +++ b/examples/master/dialog.cpp @@ -65,7 +65,7 @@ Dialog::Dialog(QWidget *parent) , statusLabel(new QLabel(tr("Status: Not running."))) , runButton(new QPushButton(tr("Start"))) { - foreach (const SerialPortInfo &info, SerialPortInfo::availablePorts()) + foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) serialPortComboBox->addItem(info.portName()); waitResponseSpinBox->setRange(0, 10000); @@ -108,31 +108,31 @@ void Dialog::sendRequest() return; } - if (!serial.setBaudRate(SerialPort::Baud9600)) { + if (!serial.setBaudRate(QSerialPort::Baud9600)) { processError(tr("Can't set rate 9600 baud to port %1, error code %2") .arg(serial.portName()).arg(serial.error())); return; } - if (!serial.setDataBits(SerialPort::Data8)) { + if (!serial.setDataBits(QSerialPort::Data8)) { processError(tr("Can't set 8 data bits to port %1, error code %2") .arg(serial.portName()).arg(serial.error())); return; } - if (!serial.setParity(SerialPort::NoParity)) { + if (!serial.setParity(QSerialPort::NoParity)) { processError(tr("Can't set no patity to port %1, error code %2") .arg(serial.portName()).arg(serial.error())); return; } - if (!serial.setStopBits(SerialPort::OneStop)) { + if (!serial.setStopBits(QSerialPort::OneStop)) { processError(tr("Can't set 1 stop bit to port %1, error code %2") .arg(serial.portName()).arg(serial.error())); return; } - if (!serial.setFlowControl(SerialPort::NoFlowControl)) { + if (!serial.setFlowControl(QSerialPort::NoFlowControl)) { processError(tr("Can't set no flow control to port %1, error code %2") .arg(serial.portName()).arg(serial.error())); return; diff --git a/examples/master/dialog.h b/examples/master/dialog.h index 0dfa271..e2100ac 100644 --- a/examples/master/dialog.h +++ b/examples/master/dialog.h @@ -83,7 +83,7 @@ private: QLabel *statusLabel; QPushButton *runButton; - SerialPort serial; + QSerialPort serial; QByteArray response; QTimer timer; }; diff --git a/examples/slave/dialog.cpp b/examples/slave/dialog.cpp index 3c4c59a..922fb61 100644 --- a/examples/slave/dialog.cpp +++ b/examples/slave/dialog.cpp @@ -68,7 +68,7 @@ Dialog::Dialog(QWidget *parent) waitRequestSpinBox->setRange(0, 10000); waitRequestSpinBox->setValue(20); - foreach (const SerialPortInfo &info, SerialPortInfo::availablePorts()) + foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) serialPortComboBox->addItem(info.portName()); QGridLayout *mainLayout = new QGridLayout; @@ -115,31 +115,31 @@ void Dialog::startSlave() return; } - if (!serial.setBaudRate(SerialPort::Baud9600)) { + if (!serial.setBaudRate(QSerialPort::Baud9600)) { processError(tr("Can't set baud rate 9600 baud to port %1, error code %2") .arg(serial.portName()).arg(serial.error())); return; } - if (!serial.setDataBits(SerialPort::Data8)) { + if (!serial.setDataBits(QSerialPort::Data8)) { processError(tr("Can't set 8 data bits to port %1, error code %2") .arg(serial.portName()).arg(serial.error())); return; } - if (!serial.setParity(SerialPort::NoParity)) { + if (!serial.setParity(QSerialPort::NoParity)) { processError(tr("Can't set no patity to port %1, error code %2") .arg(serial.portName()).arg(serial.error())); return; } - if (!serial.setStopBits(SerialPort::OneStop)) { + if (!serial.setStopBits(QSerialPort::OneStop)) { processError(tr("Can't set 1 stop bit to port %1, error code %2") .arg(serial.portName()).arg(serial.error())); return; } - if (!serial.setFlowControl(SerialPort::NoFlowControl)) { + if (!serial.setFlowControl(QSerialPort::NoFlowControl)) { processError(tr("Can't set no flow control to port %1, error code %2") .arg(serial.portName()).arg(serial.error())); return; diff --git a/examples/slave/dialog.h b/examples/slave/dialog.h index 995ae4c..f876298 100644 --- a/examples/slave/dialog.h +++ b/examples/slave/dialog.h @@ -83,7 +83,7 @@ private: QLabel *statusLabel; QPushButton *runButton; - SerialPort serial; + QSerialPort serial; QByteArray request; QTimer timer; }; diff --git a/examples/slave/slavethread.cpp b/examples/slave/slavethread.cpp index e3ed22a..83da104 100644 --- a/examples/slave/slavethread.cpp +++ b/examples/slave/slavethread.cpp @@ -86,7 +86,7 @@ void SlaveThread::run() QString currentRespone = response; mutex.unlock(); - SerialPort serial; + QSerialPort serial; while (!quit) { @@ -100,31 +100,31 @@ void SlaveThread::run() return; } - if (!serial.setBaudRate(SerialPort::Baud9600)) { + if (!serial.setBaudRate(QSerialPort::Baud9600)) { emit error(tr("Can't set baud rate 9600 baud to port %1, error code %2") .arg(portName).arg(serial.error())); return; } - if (!serial.setDataBits(SerialPort::Data8)) { + if (!serial.setDataBits(QSerialPort::Data8)) { emit error(tr("Can't set 8 data bits to port %1, error code %2") .arg(portName).arg(serial.error())); return; } - if (!serial.setParity(SerialPort::NoParity)) { + if (!serial.setParity(QSerialPort::NoParity)) { emit error(tr("Can't set no patity to port %1, error code %2") .arg(portName).arg(serial.error())); return; } - if (!serial.setStopBits(SerialPort::OneStop)) { + if (!serial.setStopBits(QSerialPort::OneStop)) { emit error(tr("Can't set 1 stop bit to port %1, error code %2") .arg(portName).arg(serial.error())); return; } - if (!serial.setFlowControl(SerialPort::NoFlowControl)) { + if (!serial.setFlowControl(QSerialPort::NoFlowControl)) { emit error(tr("Can't set no flow control to port %1, error code %2") .arg(portName).arg(serial.error())); return; diff --git a/examples/terminal/mainwindow.cpp b/examples/terminal/mainwindow.cpp index 079b541..dffb4f8 100644 --- a/examples/terminal/mainwindow.cpp +++ b/examples/terminal/mainwindow.cpp @@ -59,7 +59,7 @@ MainWindow::MainWindow(QWidget *parent) : console->setEnabled(false); setCentralWidget(console); //! [1] - serial = new SerialPort(this); + serial = new QSerialPort(this); //! [1] settings = new SettingsDialog; diff --git a/examples/terminal/mainwindow.h b/examples/terminal/mainwindow.h index a3dfbeb..272bcce 100644 --- a/examples/terminal/mainwindow.h +++ b/examples/terminal/mainwindow.h @@ -57,7 +57,7 @@ class Console; class SettingsDialog; QT_BEGIN_NAMESPACE_SERIALPORT -class SerialPort; +class QSerialPort; QT_END_NAMESPACE_SERIALPORT QT_USE_NAMESPACE_SERIALPORT @@ -84,7 +84,7 @@ private: Ui::MainWindow *ui; Console *console; SettingsDialog *settings; - SerialPort *serial; + QSerialPort *serial; }; #endif // MAINWINDOW_H diff --git a/examples/terminal/settingsdialog.cpp b/examples/terminal/settingsdialog.cpp index 54a48c9..5d13cdf 100644 --- a/examples/terminal/settingsdialog.cpp +++ b/examples/terminal/settingsdialog.cpp @@ -112,43 +112,43 @@ void SettingsDialog::fillPortsParameters() { // fill baud rate (is not the entire list of available values, // desired values??, add your independently) - ui->baudRateBox->addItem(QLatin1String("9600"), SerialPort::Baud9600); - ui->baudRateBox->addItem(QLatin1String("19200"), SerialPort::Baud19200); - ui->baudRateBox->addItem(QLatin1String("38400"), SerialPort::Baud38400); - ui->baudRateBox->addItem(QLatin1String("115200"), SerialPort::Baud115200); + ui->baudRateBox->addItem(QLatin1String("9600"), QSerialPort::Baud9600); + ui->baudRateBox->addItem(QLatin1String("19200"), QSerialPort::Baud19200); + ui->baudRateBox->addItem(QLatin1String("38400"), QSerialPort::Baud38400); + ui->baudRateBox->addItem(QLatin1String("115200"), QSerialPort::Baud115200); ui->baudRateBox->addItem(QLatin1String("Custom")); // fill data bits - ui->dataBitsBox->addItem(QLatin1String("5"), SerialPort::Data5); - ui->dataBitsBox->addItem(QLatin1String("6"), SerialPort::Data6); - ui->dataBitsBox->addItem(QLatin1String("7"), SerialPort::Data7); - ui->dataBitsBox->addItem(QLatin1String("8"), SerialPort::Data8); + ui->dataBitsBox->addItem(QLatin1String("5"), QSerialPort::Data5); + ui->dataBitsBox->addItem(QLatin1String("6"), QSerialPort::Data6); + ui->dataBitsBox->addItem(QLatin1String("7"), QSerialPort::Data7); + ui->dataBitsBox->addItem(QLatin1String("8"), QSerialPort::Data8); ui->dataBitsBox->setCurrentIndex(3); // fill parity - ui->parityBox->addItem(QLatin1String("None"), SerialPort::NoParity); - ui->parityBox->addItem(QLatin1String("Even"), SerialPort::EvenParity); - ui->parityBox->addItem(QLatin1String("Odd"), SerialPort::OddParity); - ui->parityBox->addItem(QLatin1String("Mark"), SerialPort::MarkParity); - ui->parityBox->addItem(QLatin1String("Space"), SerialPort::SpaceParity); + ui->parityBox->addItem(QLatin1String("None"), QSerialPort::NoParity); + ui->parityBox->addItem(QLatin1String("Even"), QSerialPort::EvenParity); + ui->parityBox->addItem(QLatin1String("Odd"), QSerialPort::OddParity); + ui->parityBox->addItem(QLatin1String("Mark"), QSerialPort::MarkParity); + ui->parityBox->addItem(QLatin1String("Space"), QSerialPort::SpaceParity); // fill stop bits - ui->stopBitsBox->addItem(QLatin1String("1"), SerialPort::OneStop); + ui->stopBitsBox->addItem(QLatin1String("1"), QSerialPort::OneStop); #ifdef Q_OS_WIN - ui->stopBitsBox->addItem(QLatin1String("1.5"), SerialPort::OneAndHalfStop); + ui->stopBitsBox->addItem(QLatin1String("1.5"), QSerialPort::OneAndHalfStop); #endif - ui->stopBitsBox->addItem(QLatin1String("2"), SerialPort::TwoStop); + ui->stopBitsBox->addItem(QLatin1String("2"), QSerialPort::TwoStop); // fill flow control - ui->flowControlBox->addItem(QLatin1String("None"), SerialPort::NoFlowControl); - ui->flowControlBox->addItem(QLatin1String("RTS/CTS"), SerialPort::HardwareControl); - ui->flowControlBox->addItem(QLatin1String("XON/XOFF"), SerialPort::SoftwareControl); + ui->flowControlBox->addItem(QLatin1String("None"), QSerialPort::NoFlowControl); + ui->flowControlBox->addItem(QLatin1String("RTS/CTS"), QSerialPort::HardwareControl); + ui->flowControlBox->addItem(QLatin1String("XON/XOFF"), QSerialPort::SoftwareControl); } void SettingsDialog::fillPortsInfo() { ui->portsBox->clear(); - foreach (const SerialPortInfo &info, SerialPortInfo::availablePorts()) { + foreach (const QSerialPortInfo &info, QSerialPortInfo::availablePorts()) { QStringList list; list << info.portName() << info.description() << info.manufacturer() << info.systemLocation() @@ -168,28 +168,28 @@ void SettingsDialog::updateSettings() currentSettings.baudRate = ui->baudRateBox->currentText().toInt(); } else { // standard baud rate - currentSettings.baudRate = static_cast<SerialPort::BaudRate>( + currentSettings.baudRate = static_cast<QSerialPort::BaudRate>( ui->baudRateBox->itemData(ui->baudRateBox->currentIndex()).toInt()); } currentSettings.stringBaudRate = QString::number(currentSettings.baudRate); // Data bits - currentSettings.dataBits = static_cast<SerialPort::DataBits>( + currentSettings.dataBits = static_cast<QSerialPort::DataBits>( ui->dataBitsBox->itemData(ui->dataBitsBox->currentIndex()).toInt()); currentSettings.stringDataBits = ui->dataBitsBox->currentText(); // Parity - currentSettings.parity = static_cast<SerialPort::Parity>( + currentSettings.parity = static_cast<QSerialPort::Parity>( ui->parityBox->itemData(ui->parityBox->currentIndex()).toInt()); currentSettings.stringParity = ui->parityBox->currentText(); // Stop bits - currentSettings.stopBits = static_cast<SerialPort::StopBits>( + currentSettings.stopBits = static_cast<QSerialPort::StopBits>( ui->stopBitsBox->itemData(ui->stopBitsBox->currentIndex()).toInt()); currentSettings.stringStopBits = ui->stopBitsBox->currentText(); // Flow control - currentSettings.flowControl = static_cast<SerialPort::FlowControl>( + currentSettings.flowControl = static_cast<QSerialPort::FlowControl>( ui->flowControlBox->itemData(ui->flowControlBox->currentIndex()).toInt()); currentSettings.stringFlowControl = ui->flowControlBox->currentText(); } diff --git a/examples/terminal/settingsdialog.h b/examples/terminal/settingsdialog.h index ef3ab25..bfdf9f3 100644 --- a/examples/terminal/settingsdialog.h +++ b/examples/terminal/settingsdialog.h @@ -63,13 +63,13 @@ public: QString name; qint32 baudRate; QString stringBaudRate; - SerialPort::DataBits dataBits; + QSerialPort::DataBits dataBits; QString stringDataBits; - SerialPort::Parity parity; + QSerialPort::Parity parity; QString stringParity; - SerialPort::StopBits stopBits; + QSerialPort::StopBits stopBits; QString stringStopBits; - SerialPort::FlowControl flowControl; + QSerialPort::FlowControl flowControl; QString stringFlowControl; }; |