Doc: Clarify how to use QPainter with QTextEdit
The documentation suggests that it is possible to reimplement QTextEdit::paintEvent(), but doing so might produce cryptic runtime warnings: QWidget::paintEngine: Should no longer be called QPainter::begin: Paint device returned engine == 0, type: 1 The correct way to reimplement this function is noted under QAbstractScrollArea::paintEvent(). This patch updates the note and copies it to QTextEdit for clarity. Change-Id: Ib7d8dadeb2358475bcdb0b2e624857700f9a004e Reviewed-by: Safiyyah Moosa <safiyyah.moosa@qt.io> Reviewed-by: Andreas Eliasson <andreas.eliasson@qt.io> Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io> (cherry picked from commit 5a2474b2dd0472948c53b16c4bf566db489dcfb9) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
3ce73dc0d6
commit
53e351a1ad
@ -1100,7 +1100,7 @@ void QAbstractScrollArea::resizeEvent(QResizeEvent *)
|
||||
This event handler can be reimplemented in a subclass to receive
|
||||
paint events (passed in \a event), for the viewport() widget.
|
||||
|
||||
\note If you open a painter, make sure to open it on the viewport().
|
||||
\note If you create a QPainter, it must operate on the viewport().
|
||||
|
||||
\sa QWidget::paintEvent()
|
||||
*/
|
||||
|
@ -1599,6 +1599,8 @@ void QTextEditPrivate::paint(QPainter *p, QPaintEvent *e)
|
||||
This event handler can be reimplemented in a subclass to receive paint events passed in \a event.
|
||||
It is usually unnecessary to reimplement this function in a subclass of QTextEdit.
|
||||
|
||||
\note If you create a QPainter, it must operate on the \l{QAbstractScrollArea::}{viewport()}.
|
||||
|
||||
\warning The underlying text document must not be modified from within a reimplementation
|
||||
of this function.
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user