summaryrefslogtreecommitdiffstats
path: root/src/gui/text/qfont.cpp
diff options
context:
space:
mode:
authorLuca Beldi <v.ronin@yahoo.it>2018-11-13 08:54:37 +0000
committerLuca Beldi <v.ronin@yahoo.it>2018-11-19 10:41:54 +0000
commitc0c4be672bd652d29a5c8f52e31ad76a1361e320 (patch)
tree2755bc52194cc382d3c47859f580db88ce3bc691 /src/gui/text/qfont.cpp
parent85b4aaaa99556fa248a7d688d2fe9d99d28234b0 (diff)
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 <samuel.gaist@idiap.ch> Reviewed-by: Christian Ehrlicher <ch.ehrlicher@gmx.de> Reviewed-by: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@qt.io>
Diffstat (limited to 'src/gui/text/qfont.cpp')
-rw-r--r--src/gui/text/qfont.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp
index 258a9ba675..27d804a3b4 100644
--- a/src/gui/text/qfont.cpp
+++ b/src/gui/text/qfont.cpp
@@ -562,14 +562,25 @@ QFontEngineData::~QFontEngineData()
\since 5.2
*/
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
/*!
+ \obsolete
Constructs a font from \a font for use on the paint device \a pd.
*/
QFont::QFont(const QFont &font, QPaintDevice *pd)
+ : QFont(font, static_cast<const QPaintDevice*>(pd))
+{}
+#endif
+
+/*!
+ \since 5.13
+ Constructs a font from \a font for use on the paint device \a pd.
+*/
+QFont::QFont(const QFont &font, const QPaintDevice *pd)
: resolve_mask(font.resolve_mask)
{
- Q_ASSERT(pd != 0);
- int dpi = pd->logicalDpiY();
+ Q_ASSERT(pd);
+ const int dpi = pd->logicalDpiY();
const int screen = 0;
if (font.d->dpi != dpi || font.d->screen != screen ) {
d = new QFontPrivate(*font.d);