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 Rempt2321b4bbf73d
diff --git a/libs/widgets/kis_color_input.cpp b/libs/widgets/kis_color_input.cpp
index b632e369c6..bfa162de9a 100644
--- a/libs/widgets/kis_color_input.cpp
+++ b/libs/widgets/kis_color_input.cpp
@@ -679,24 +679,44 @@ void KisHsvColorInput::fillColor(QColor& c, const qreal& h, const qreal& s, cons
void KisHsvColorInput::getHsxF(const QColor& color, qreal* h, qreal* s, qreal* x)
{
qreal tempH;
- switch (m_mixMode) {
- case KisHsvColorSlider::MIX_MODE::HSL:
+#if (QT_VERSION > QT_VERSION_CHECK(6, 0, 0))
+ float fS = *s;
+ float fX = *x;
+#endif
+ switch (m_mixMode) {
+ case KisHsvColorSlider::MIX_MODE::HSL:
+ {
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
color.getHslF(&tempH, s, x);
+#else
+ float th;
+ color.getHslF(&th, &fS, &fX);
+ tempH = th;
+#endif
+ }
break;
case KisHsvColorSlider::MIX_MODE::HSY: {
- RGBToHSY(color.redF(), color.greenF(), color.blueF(), &tempH, s, x);
+ RGBToHSY(color.redF(), color.greenF(), color.blueF(), &tempH, s, x);
break;
}
case KisHsvColorSlider::MIX_MODE::HSI: {
- RGBToHSI(color.redF(), color.greenF(), color.blueF(), &tempH, s, x);
+ RGBToHSI(color.redF(), color.greenF(), color.blueF(), &tempH, s, x);
break;
}
default: // fallthrough
case KisHsvColorSlider::MIX_MODE::HSV:
+ {
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
color.getHsvF(&tempH, s, x);
+#else
+ float th;
+ color.getHsvF(&th, &fS, &fX);
+ tempH = th;
+#endif
+ }
break;
}