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>
This commit is contained in:
parent
c21cee827f
commit
33c59be551
@ -630,6 +630,9 @@ Qt::CursorMoveStyle QTextLayout::cursorMoveStyle() const
|
|||||||
/*!
|
/*!
|
||||||
Begins the layout process.
|
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()
|
\sa endLayout()
|
||||||
*/
|
*/
|
||||||
void QTextLayout::beginLayout()
|
void QTextLayout::beginLayout()
|
||||||
@ -673,6 +676,9 @@ void QTextLayout::endLayout()
|
|||||||
|
|
||||||
Clears the line information in the layout. After having called
|
Clears the line information in the layout. After having called
|
||||||
this function, lineCount() returns 0.
|
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()
|
void QTextLayout::clearLayout()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user