diff options
-rw-r--r-- | src/serialport/qserialport.cpp | 19 | ||||
-rw-r--r-- | src/serialport/qserialport.h | 3 | ||||
-rw-r--r-- | src/serialport/qserialport_p.h | 6 |
3 files changed, 14 insertions, 14 deletions
diff --git a/src/serialport/qserialport.cpp b/src/serialport/qserialport.cpp index 0312b44..bbbfaf8 100644 --- a/src/serialport/qserialport.cpp +++ b/src/serialport/qserialport.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE -QSerialPortPrivate::QSerialPortPrivate(QSerialPort *q) +QSerialPortPrivate::QSerialPortPrivate() : readBufferMaxSize(0) , readBuffer(SERIALPORT_BUFFERSIZE) , writeBuffer(SERIALPORT_BUFFERSIZE) @@ -60,7 +60,6 @@ QSerialPortPrivate::QSerialPortPrivate(QSerialPort *q) #if QT_DEPRECATED_SINCE(5,3) , settingsRestoredOnClose(true) #endif - , q_ptr(q) #if defined (Q_OS_WINCE) , handle(INVALID_HANDLE_VALUE) , parityErrorOccurred(false) @@ -400,9 +399,10 @@ int QSerialPortPrivate::timeoutValue(int msecs, int elapsed) Constructs a new serial port object with the given \a parent. */ QSerialPort::QSerialPort(QObject *parent) - : QIODevice(parent) - , d_ptr(new QSerialPortPrivate(this)) -{} + : QIODevice(*new QSerialPortPrivate, parent) + , d_dummy(0) +{ +} /*! Constructs a new serial port object with the given \a parent @@ -411,8 +411,8 @@ QSerialPort::QSerialPort(QObject *parent) The name should have a specific format; see the setPort() method. */ QSerialPort::QSerialPort(const QString &name, QObject *parent) - : QIODevice(parent) - , d_ptr(new QSerialPortPrivate(this)) + : QIODevice(*new QSerialPortPrivate, parent) + , d_dummy(0) { setPortName(name); } @@ -423,8 +423,8 @@ QSerialPort::QSerialPort(const QString &name, QObject *parent) \a serialPortInfo. */ QSerialPort::QSerialPort(const QSerialPortInfo &serialPortInfo, QObject *parent) - : QIODevice(parent) - , d_ptr(new QSerialPortPrivate(this)) + : QIODevice(*new QSerialPortPrivate, parent) + , d_dummy(0) { setPort(serialPortInfo); } @@ -437,7 +437,6 @@ QSerialPort::~QSerialPort() /**/ if (isOpen()) close(); - delete d_ptr; } /*! diff --git a/src/serialport/qserialport.h b/src/serialport/qserialport.h index a8f9a05..d1a66ce 100644 --- a/src/serialport/qserialport.h +++ b/src/serialport/qserialport.h @@ -269,7 +269,8 @@ protected: private: void setError(QSerialPort::SerialPortError error, const QString &errorString = QString()); - QSerialPortPrivate * const d_ptr; + // ### Qt6: remove me. + QSerialPortPrivate * const d_dummy; Q_DISABLE_COPY(QSerialPort) diff --git a/src/serialport/qserialport_p.h b/src/serialport/qserialport_p.h index f0d6fff..4dcf634 100644 --- a/src/serialport/qserialport_p.h +++ b/src/serialport/qserialport_p.h @@ -50,6 +50,7 @@ #include "qserialport.h" #include <private/qringbuffer_p.h> +#include <private/qiodevice_p.h> #if defined (Q_OS_WINCE) # include <QtCore/qmutex.h> @@ -108,7 +109,7 @@ class QSocketNotifier; QString serialPortLockFilePath(const QString &portName); #endif -class QSerialPortPrivate +class QSerialPortPrivate : public QIODevicePrivate { Q_DECLARE_PUBLIC(QSerialPort) public: @@ -116,7 +117,7 @@ public: ReadChunkSize = 512 }; - QSerialPortPrivate(QSerialPort *q); + QSerialPortPrivate(); int timeoutValue(int msecs, int elapsed); @@ -175,7 +176,6 @@ public: bool dataTerminalReady; bool requestToSend; bool settingsRestoredOnClose; - QSerialPort * const q_ptr; #if defined (Q_OS_WINCE) |