Skip to content

Commit

Permalink
QPaintDevice: inline keyword only on a method's declaration in-class
Browse files Browse the repository at this point in the history
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 a5953d2.

Found in API review.

[1] https://wiki.qt.io/Things_To_Look_Out_For_In_Reviews#Methods item
1.2

Pick-to: 6.8
Change-Id: Ieaba422670261330b5558f60dce2fcca2cb2723b
Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
  • Loading branch information
Ahmad Samir committed Jun 20, 2024
1 parent d8cb204 commit 77f5846
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/gui/painting/qpaintdevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/gui/painting/qpaintdevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class Q_GUI_EXPORT QPaintDevice // device for QPa
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:
Expand All @@ -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));
Expand Down

0 comments on commit 77f5846

Please sign in to comment.