Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Qt6: ifdef between qreal* and float* for QColor

Halla Rempt045e8f5ca50c
diff --git a/libs/ui/canvas/kis_display_color_converter.cpp b/libs/ui/canvas/kis_display_color_converter.cpp
index 58b4e7150c..9408129060 100644
--- a/libs/ui/canvas/kis_display_color_converter.cpp
+++ b/libs/ui/canvas/kis_display_color_converter.cpp
@@ -704,7 +704,20 @@ void KisDisplayColorConverter::getHsvF(const KoColor &srcColor, qreal *h, qreal
{
// we are going through sRGB here!
QColor color = m_d->approximateToQColor(srcColor);
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
color.getHsvF(h, s, v, a);
+#else
+ float fH, fS, fV, fA;
+ fH = *h;
+ fS = *s;
+ fV = *v;
+ fA = *a;
+ color.getHsvF(&fH, &fS, &fV, &fA);
+ *h = fH;
+ *s = fS;
+ *v = fV;
+ *a = fA;
+#endif
}
KoColor KisDisplayColorConverter::fromHslF(qreal h, qreal s, qreal l, qreal a)
@@ -723,7 +736,21 @@ void KisDisplayColorConverter::getHslF(const KoColor &srcColor, qreal *h, qreal
{
// we are going through sRGB here!
QColor color = m_d->approximateToQColor(srcColor);
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
color.getHslF(h, s, l, a);
+#else
+ float fH, fS, fL, fA;
+ fH = *h;
+ fS = *s;
+ fL = *l;
+ fA = *a;
+ color.getHslF(&fH, &fS, &fL, &fA);
+ *h = fH;
+ *s = fS;
+ *l = fL;
+ *a = fA;
+
+#endif
}
KoColor KisDisplayColorConverter::fromHsiF(qreal h, qreal s, qreal i)