QTextStream: make dtor non-virtual come Qt 7
There's no reason to treat QTextStream polymorphically: it has no virtual functions other than the dtor. So don't. Removing the vtable is BiC, so we can only do it come Qt 7, but let's warn already, and "deprecate" the virtual'ness (indirectly) by marking the class final as an opt-in. The extra macro beside the class name throws off syncqt, so add a #pragma qt_class. [ChangeLog][Deprecation Notice] Inheriting QTextStream is deprecated. QTextStream will no longer have a virtual destructor in Qt 7. If your code inherits QTextStream, port to a design that doesn't require a polymorphic QTextStream. You may define the macro QT_NO_INHERITABLE_TEXT_STREAM to mark QTextStream as final to assist you in checking for such code. This is the default if you're compiling with QT_DISABLE_DEPRECATED_UP_TO set to Qt 6.9. Fixes: QTBUG-111051 Change-Id: Ib32b8c0e49990d791cdc502bf40cb250f034404b Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
parent
545400addd
commit
c889ffed9f
@ -12,6 +12,11 @@
|
|||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
// the macros around the class name throw off syncqt:
|
||||||
|
#pragma qt_class(QTextStream)
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef Status
|
#ifdef Status
|
||||||
#error qtextstream.h must be included before any header file that defines Status
|
#error qtextstream.h must be included before any header file that defines Status
|
||||||
#endif
|
#endif
|
||||||
@ -22,8 +27,18 @@ class QIODevice;
|
|||||||
class QLocale;
|
class QLocale;
|
||||||
class QString;
|
class QString;
|
||||||
|
|
||||||
|
#if !QT_DEPRECATED_SINCE(6, 9)
|
||||||
|
# define QT_NO_INHERITABLE_TEXT_STREAM
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef QT_NO_INHERITABLE_TEXT_STREAM
|
||||||
|
# define QT_TEXT_STREAM_FINAL final
|
||||||
|
#else
|
||||||
|
# define QT_TEXT_STREAM_FINAL
|
||||||
|
#endif
|
||||||
|
|
||||||
class QTextStreamPrivate;
|
class QTextStreamPrivate;
|
||||||
class Q_CORE_EXPORT QTextStream : public QIODeviceBase
|
class Q_CORE_EXPORT QTextStream QT_TEXT_STREAM_FINAL : public QIODeviceBase
|
||||||
{
|
{
|
||||||
Q_DECLARE_PRIVATE(QTextStream)
|
Q_DECLARE_PRIVATE(QTextStream)
|
||||||
|
|
||||||
@ -60,7 +75,8 @@ public:
|
|||||||
explicit QTextStream(QString *string, OpenMode openMode = ReadWrite);
|
explicit QTextStream(QString *string, OpenMode openMode = ReadWrite);
|
||||||
explicit QTextStream(QByteArray *array, OpenMode openMode = ReadWrite);
|
explicit QTextStream(QByteArray *array, OpenMode openMode = ReadWrite);
|
||||||
explicit QTextStream(const QByteArray &array, OpenMode openMode = ReadOnly);
|
explicit QTextStream(const QByteArray &array, OpenMode openMode = ReadOnly);
|
||||||
virtual ~QTextStream();
|
QT6_ONLY(virtual)
|
||||||
|
~QTextStream();
|
||||||
|
|
||||||
void setEncoding(QStringConverter::Encoding encoding);
|
void setEncoding(QStringConverter::Encoding encoding);
|
||||||
QStringConverter::Encoding encoding() const;
|
QStringConverter::Encoding encoding() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user