From ea138d75574d2fe52db55c4f6e0f010ecb77c04c Mon Sep 17 00:00:00 2001 From: Ahmad Samir Date: Thu, 20 Jun 2024 04:16:39 +0300 Subject: [PATCH] QPaintDevice: inline keyword only on a method's declaration in-class Putting `inline` on the definition and not the declaration could cause some issues with some compilers, e.g. MinGW[1]. Putting `inline` on a method's declaration and definition is redundant; I am not sure if that could cause an issue with MinGW, but just in-class on the declaration is enough/more-idiomatic. Amends a5953d20e27ab73774058dd06ac514f9310a41e8. Found in API review. [1] https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews#Methods item 1.2 Change-Id: Ieaba422670261330b5558f60dce2fcca2cb2723b Reviewed-by: Eirik Aavitsland (cherry picked from commit 77f5846d213b8355d369695c68d585d0d5fa47ce) Reviewed-by: Qt Cherry-pick Bot --- src/gui/painting/qpaintdevice.cpp | 2 +- src/gui/painting/qpaintdevice.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/painting/qpaintdevice.cpp b/src/gui/painting/qpaintdevice.cpp index de21901e239..21c7e406f18 100644 --- a/src/gui/painting/qpaintdevice.cpp +++ b/src/gui/painting/qpaintdevice.cpp @@ -21,7 +21,7 @@ QPaintDevice::~QPaintDevice() \internal */ // ### Qt 7: Replace this workaround mechanism: virtual devicePixelRatio() and virtual metricF() -inline double QPaintDevice::getDecodedMetricF(PaintDeviceMetric metricA, PaintDeviceMetric metricB) const +double QPaintDevice::getDecodedMetricF(PaintDeviceMetric metricA, PaintDeviceMetric metricB) const { qint32 buf[2]; // The Encoded metric enum values come in pairs of one odd and one even value. diff --git a/src/gui/painting/qpaintdevice.h b/src/gui/painting/qpaintdevice.h index 7011684df7f..e83e97a02c7 100644 --- a/src/gui/painting/qpaintdevice.h +++ b/src/gui/painting/qpaintdevice.h @@ -61,7 +61,7 @@ protected: virtual void initPainter(QPainter *painter) const; virtual QPaintDevice *redirected(QPoint *offset) const; virtual QPainter *sharedPainter() const; - double getDecodedMetricF(PaintDeviceMetric metricA, PaintDeviceMetric metricB) const; + inline double getDecodedMetricF(PaintDeviceMetric metricA, PaintDeviceMetric metricB) const; ushort painters; // refcount private: @@ -84,7 +84,7 @@ inline int QPaintDevice::devType() const inline bool QPaintDevice::paintingActive() const { return painters != 0; } -inline int QPaintDevice::encodeMetricF(PaintDeviceMetric metric, double value) +int QPaintDevice::encodeMetricF(PaintDeviceMetric metric, double value) { qint32 buf[2]; Q_STATIC_ASSERT(sizeof(buf) == sizeof(double));