diff options
author | Karsten Heimrich <karsten.heimrich@qt.io> | 2021-01-27 16:06:52 +0100 |
---|---|---|
committer | Karsten Heimrich <karsten.heimrich@qt.io> | 2021-02-01 14:03:09 +0100 |
commit | 3f33ab751950ecdd07df4d88274a4d7c759df98f (patch) | |
tree | fa83e4403f1a504acad596ae9f368e7bd85e70d8 /src/serialport/qserialport_p.h | |
parent | 10a76dfebfac652e926b88db3c4b8fcec896e015 (diff) |
Qt6: Migrate useful properties to new property system
Task-number: QTBUG-89885
Change-Id: I883c139e7be4ff44823170959b7daf2aa6740675
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
Reviewed-by: Alex Blasche <alexander.blasche@qt.io>
Diffstat (limited to 'src/serialport/qserialport_p.h')
-rw-r--r-- | src/serialport/qserialport_p.h | 44 |
1 files changed, 36 insertions, 8 deletions
diff --git a/src/serialport/qserialport_p.h b/src/serialport/qserialport_p.h index 7348aed6..a9c08e95 100644 --- a/src/serialport/qserialport_p.h +++ b/src/serialport/qserialport_p.h @@ -55,9 +55,11 @@ #include "qserialport.h" -#include <private/qiodevice_p.h> #include <qdeadlinetimer.h> +#include <private/qiodevice_p.h> +#include <private/qproperty_p.h> + #if defined(Q_OS_WIN32) # include <qt_windows.h> #elif defined(Q_OS_UNIX) @@ -114,7 +116,7 @@ QString serialPortLockFilePath(const QString &portName); class QSerialPortErrorInfo { public: - explicit QSerialPortErrorInfo(QSerialPort::SerialPortError newErrorCode = QSerialPort::UnknownError, + QSerialPortErrorInfo(QSerialPort::SerialPortError newErrorCode = QSerialPort::UnknownError, const QString &newErrorString = QString()); QSerialPort::SerialPortError errorCode = QSerialPort::UnknownError; QString errorString; @@ -164,16 +166,42 @@ public: static QList<qint32> standardBaudRates(); qint64 readBufferMaxSize = 0; - QSerialPort::SerialPortError error = QSerialPort::NoError; + + void setBindableError(QSerialPort::SerialPortError error) + { setError(error); } + Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QSerialPortPrivate, QSerialPort::SerialPortError, error, + &QSerialPortPrivate::setBindableError, QSerialPort::NoError) + QString systemLocation; qint32 inputBaudRate = QSerialPort::Baud9600; qint32 outputBaudRate = QSerialPort::Baud9600; - QSerialPort::DataBits dataBits = QSerialPort::Data8; - QSerialPort::Parity parity = QSerialPort::NoParity; - QSerialPort::StopBits stopBits = QSerialPort::OneStop; - QSerialPort::FlowControl flowControl = QSerialPort::NoFlowControl; + + bool setBindableDataBits(QSerialPort::DataBits dataBits) + { return q_func()->setDataBits(dataBits); } + Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QSerialPortPrivate, QSerialPort::DataBits, dataBits, + &QSerialPortPrivate::setBindableDataBits, QSerialPort::Data8) + + bool setBindableParity(QSerialPort::Parity parity) + { return q_func()->setParity(parity); } + Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QSerialPortPrivate, QSerialPort::Parity, parity, + &QSerialPortPrivate::setBindableParity, QSerialPort::NoParity) + + bool setBindableStopBits(QSerialPort::StopBits stopBits) + { return q_func()->setStopBits(stopBits); } + Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QSerialPortPrivate, QSerialPort::StopBits, stopBits, + &QSerialPortPrivate::setBindableStopBits, QSerialPort::OneStop) + + bool setBindableFlowControl(QSerialPort::FlowControl flowControl) + { return q_func()->setFlowControl(flowControl); } + Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QSerialPortPrivate, QSerialPort::FlowControl, flowControl, + &QSerialPortPrivate::setBindableFlowControl, QSerialPort::NoFlowControl) + bool settingsRestoredOnClose = true; - bool isBreakEnabled = false; + + bool setBindableBreakEnabled(bool isBreakEnabled) + { return q_func()->setBreakEnabled(isBreakEnabled); } + Q_OBJECT_COMPAT_PROPERTY_WITH_ARGS(QSerialPortPrivate, bool, isBreakEnabled, + &QSerialPortPrivate::setBindableBreakEnabled, false) bool startAsyncRead(); |