diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2016-02-10 15:43:15 +0100 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2016-02-12 18:29:54 +0000 |
commit | 7f48655fb83bbfe394dcc66f11b01bd634aa2388 (patch) | |
tree | 7fecab2cd0b76e12e033110f8515d426df34d5c3 /src/gui/text | |
parent | 6ffb0bdf60cbd592c37ad8104db288a30596c6bf (diff) |
QTextFrame::iterator: restore nothrow move special members
The user-defined copy assignment and copy constructors
inhibit the move special member functions.
We cannot do something about it in Qt 5, because the
class is exported (which it shouldn't be), and because
making it trivially-copyable might change how it is
passed to functions by value, so we need to supply all
the missing member functions manually.
Change-Id: Ic710b449f6abd386449fa6df71e8bc9bd0f98d2b
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qtextobject.cpp | 4 | ||||
-rw-r--r-- | src/gui/text/qtextobject.h | 10 |
2 files changed, 9 insertions, 5 deletions
diff --git a/src/gui/text/qtextobject.cpp b/src/gui/text/qtextobject.cpp index 49cf35ecc0..a756549f3e 100644 --- a/src/gui/text/qtextobject.cpp +++ b/src/gui/text/qtextobject.cpp @@ -675,7 +675,7 @@ QTextFrame::iterator::iterator(QTextFrame *frame, int block, int begin, int end) /*! Copy constructor. Constructs a copy of the \a other iterator. */ -QTextFrame::iterator::iterator(const iterator &other) +QTextFrame::iterator::iterator(const iterator &other) Q_DECL_NOTHROW { f = other.f; b = other.b; @@ -688,7 +688,7 @@ QTextFrame::iterator::iterator(const iterator &other) Assigns \a other to this iterator and returns a reference to this iterator. */ -QTextFrame::iterator &QTextFrame::iterator::operator=(const iterator &other) +QTextFrame::iterator &QTextFrame::iterator::operator=(const iterator &other) Q_DECL_NOTHROW { f = other.f; b = other.b; diff --git a/src/gui/text/qtextobject.h b/src/gui/text/qtextobject.h index 18df53945c..d3f6b3d0ac 100644 --- a/src/gui/text/qtextobject.h +++ b/src/gui/text/qtextobject.h @@ -148,10 +148,14 @@ public: friend class QTextDocumentLayoutPrivate; iterator(QTextFrame *frame, int block, int begin, int end); public: - iterator(); + iterator(); // ### Qt 6: inline #if QT_VERSION < QT_VERSION_CHECK(6,0,0) - iterator(const iterator &o); - iterator &operator=(const iterator &o); + iterator(const iterator &o) Q_DECL_NOTHROW; // = default + iterator &operator=(const iterator &o) Q_DECL_NOTHROW; // = default + iterator(iterator &&other) Q_DECL_NOTHROW // = default + { memcpy(this, &other, sizeof(iterator)); } + iterator &operator=(iterator &&other) Q_DECL_NOTHROW // = default + { memcpy(this, &other, sizeof(iterator)); return *this; } #endif QTextFrame *parentFrame() const { return f; } |