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++

Fix qt5 build by not testing color model.

Wolthera van Hövell tot Westerfliera2202fc15f32
diff --git a/libs/ui/KisReferenceImage.cpp b/libs/ui/KisReferenceImage.cpp
index 163549340b..5f999a4ea0 100644
--- a/libs/ui/KisReferenceImage.cpp
+++ b/libs/ui/KisReferenceImage.cpp
@@ -92,9 +92,11 @@ struct KisReferenceImage::Private : public QSharedData
// See https://bugs.kde.org/show_bug.cgi?id=416515 -- a jpeg image
// loaded into a qimage cannot be saved to png unless we explicitly
// convert the colorspace of the QImage
+#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (image.colorSpace().colorModel() != QColorSpace::ColorModel::Rgb || !image.colorSpace().isValid()) {
image.convertToColorSpace(QColorSpace(QColorSpace::SRgb));
}
+#endif
return (!image.isNull());
}
@@ -265,7 +267,11 @@ void KisReferenceImage::paint(QPainter &gc) const
// Color conversion.
QImage *targetD = dynamic_cast<QImage*>(gc.device());
+#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
+ const bool getTargetCs = (targetD);
+#else
const bool getTargetCs = (targetD && targetD->colorSpace().colorModel() == QColorSpace::ColorModel::Rgb);
+#endif
const KoColorProfile *targetP = getTargetCs? KoColorSpaceRegistry::instance()->profileForQColorSpace(targetD->colorSpace()): KoColorSpaceRegistry::instance()->p709SRGBProfile();
const KoColorProfile *sourceP = KoColorSpaceRegistry::instance()->profileForQColorSpace(d->image.colorSpace());
if (targetP != sourceP) {