From b262dd3d29a387dd1e74c0b5af8e3d4966638532 Mon Sep 17 00:00:00 2001 From: John Thacker Date: Fri, 18 Nov 2022 08:30:36 -0500 Subject: [PATCH] QCustomPlot: Fix clang warning on Qt5 Fix a shortening warning from qint64 to int on Qt5. --- ui/qt/widgets/qcustomplot.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/ui/qt/widgets/qcustomplot.cpp b/ui/qt/widgets/qcustomplot.cpp index b10519438e..c155331433 100644 --- a/ui/qt/widgets/qcustomplot.cpp +++ b/ui/qt/widgets/qcustomplot.cpp @@ -16732,7 +16732,11 @@ void QCPColorGradient::colorize(const double *data, const QCPRange &range, QRgb if (index < 0) index += mLevelCount; } +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + scanLine[i] = mColorBuffer.at(static_cast(index)); +#else scanLine[i] = mColorBuffer.at(index); +#endif } else { switch(mNanHandling) @@ -16795,10 +16799,18 @@ void QCPColorGradient::colorize(const double *data, const unsigned char *alpha, } if (alpha[dataIndexFactor*i] == 255) { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + scanLine[i] = mColorBuffer.at(static_cast(index)); +#else scanLine[i] = mColorBuffer.at(index); +#endif } else { +#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) + const QRgb rgb = mColorBuffer.at(static_cast(index)); +#else const QRgb rgb = mColorBuffer.at(index); +#endif const float alphaF = alpha[dataIndexFactor*i]/255.0f; scanLine[i] = qRgba(int(qRed(rgb)*alphaF), int(qGreen(rgb)*alphaF), int(qBlue(rgb)*alphaF), int(qAlpha(rgb)*alphaF)); // also multiply r,g,b with alpha, to conform to Format_ARGB32_Premultiplied }