diff options
author | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2017-05-16 10:04:03 +0200 |
---|---|---|
committer | Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io> | 2017-05-22 05:40:09 +0000 |
commit | 33c59be551014c656370e0459c6cb5094ae68f3f (patch) | |
tree | 830e5875bff1c11f1b61aab7ee35400ccc94f16c /src/gui/text | |
parent | c21cee827f94d1523301f6fe45b54d993b3a1abc (diff) |
doc: Add warning about QTextLayout::beginLayout() and clearLayout()
If you keep around QTextLines referring to the previous contents of
the layout, you can experience crashes when using these after the
layout has been cleared. Since QTextLine is a value type, this is
not very obvious in the API, so we should at least give a warning
in the docs.
Task-number: QTBUG-60804
Change-Id: I81b2b640eec5f62b0af1e878aadd9fa23654ec18
Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
Reviewed-by: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io>
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'src/gui/text')
-rw-r--r-- | src/gui/text/qtextlayout.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 023a1b7f52..cc91c107f9 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -630,6 +630,9 @@ Qt::CursorMoveStyle QTextLayout::cursorMoveStyle() const /*! Begins the layout process. + \warning This will invalidate the layout, so all existing QTextLine objects + that refer to the previous contents should now be discarded. + \sa endLayout() */ void QTextLayout::beginLayout() @@ -673,6 +676,9 @@ void QTextLayout::endLayout() Clears the line information in the layout. After having called this function, lineCount() returns 0. + + \warning This will invalidate the layout, so all existing QTextLine objects + that refer to the previous contents should now be discarded. */ void QTextLayout::clearLayout() { |