From c0c4be672bd652d29a5c8f52e31ad76a1361e320 Mon Sep 17 00:00:00 2001 From: Luca Beldi Date: Tue, 13 Nov 2018 08:54:37 +0000 Subject: Fix constness of QPaintDevice arguments QFont, QFontMetrics, QFontMetricsF and QTextLayout constructors use only const methods of QPaintDevice so there is no reason for them to require a non-const pointer argument Fixes: QTBUG-65967 Change-Id: Ibfcdef2a25f0cd4284dad76135fc4c9bf5667d7a Reviewed-by: Samuel Gaist Reviewed-by: Christian Ehrlicher Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/text/qtextlayout.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'src/gui/text/qtextlayout.h') diff --git a/src/gui/text/qtextlayout.h b/src/gui/text/qtextlayout.h index 67bc75a6b8..a29791534e 100644 --- a/src/gui/text/qtextlayout.h +++ b/src/gui/text/qtextlayout.h @@ -107,7 +107,19 @@ public: // does itemization QTextLayout(); QTextLayout(const QString& text); - QTextLayout(const QString& text, const QFont &font, QPaintDevice *paintdevice = nullptr); +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + QTextLayout(const QString &text, const QFont &font, QPaintDevice *paintdevice = nullptr); +#ifndef Q_QDOC + // the template is necessary to make QTextLayout(font,text,nullptr) and QTextLayout(font,text,NULL) + // not ambiguous. Implementation detail that should not be documented. + template +#endif + QTextLayout(const QString &text, const QFont &font, const QPaintDevice *paintdevice) + : QTextLayout(text, font, const_cast(paintdevice)) + {} +#else + QTextLayout(const QString &text, const QFont &font, const QPaintDevice *paintdevice = nullptr); +#endif QTextLayout(const QTextBlock &b); ~QTextLayout(); -- cgit v1.2.3