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 building with Qt5

Dmitry Kazakov16d0a6a1e607
diff --git a/libs/ui/canvas/KoCanvasControllerWidget.h b/libs/ui/canvas/KoCanvasControllerWidget.h
index 639f9abf34..962ee6e01e 100644
--- a/libs/ui/canvas/KoCanvasControllerWidget.h
+++ b/libs/ui/canvas/KoCanvasControllerWidget.h
@@ -13,6 +13,7 @@
#include "kritaui_export.h"
+#include <optional>
#include <QAbstractScrollArea>
#include <QPointer>
#include "KoCanvasController.h"
diff --git a/libs/ui/canvas/kis_coordinates_converter.h b/libs/ui/canvas/kis_coordinates_converter.h
index 01ebc0f93a..aa47a51643 100644
--- a/libs/ui/canvas/kis_coordinates_converter.h
+++ b/libs/ui/canvas/kis_coordinates_converter.h
@@ -8,6 +8,8 @@
#ifndef KIS_COORDINATES_CONVERTER_H
#define KIS_COORDINATES_CONVERTER_H
+#include <optional>
+
#include <QTransform>
#include <KoZoomHandler.h>
diff --git a/libs/ui/tests/kis_coordinates_converter_test.cpp b/libs/ui/tests/kis_coordinates_converter_test.cpp
index c3ced32574..463bf171c4 100644
--- a/libs/ui/tests/kis_coordinates_converter_test.cpp
+++ b/libs/ui/tests/kis_coordinates_converter_test.cpp
@@ -2109,8 +2109,13 @@ void KisCoordinatesConverterTest::testHiDPIOffsetSnapping()
QCOMPARE(roundTo5thDigit(imageTopLeftInDevicePixelsHW.x()), qRound(imageTopLeftInDevicePixelsHW.x()));
QCOMPARE(roundTo5thDigit(imageTopLeftInDevicePixelsHW.y()), qRound(imageTopLeftInDevicePixelsHW.y()));
} else {
+#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
QCOMPARE_NE(roundTo5thDigit(imageTopLeftInDevicePixelsHW.x()), qRound(imageTopLeftInDevicePixelsHW.x()));
QCOMPARE_NE(roundTo5thDigit(imageTopLeftInDevicePixelsHW.y()), qRound(imageTopLeftInDevicePixelsHW.y()));
+#else
+ QVERIFY(roundTo5thDigit(imageTopLeftInDevicePixelsHW.x()) != qRound(imageTopLeftInDevicePixelsHW.x()));
+ QVERIFY(roundTo5thDigit(imageTopLeftInDevicePixelsHW.y()) != qRound(imageTopLeftInDevicePixelsHW.y()));
+#endif
}
}
}
@@ -2194,8 +2199,13 @@ void KisCoordinatesConverterTest::testPreferredCenterTransformations()
const qreal oldZoom = converter.zoom();
const QPointF oldOffset = converter.documentOffsetF();
converter.setCanvasWidgetSizeKeepZoom(QSize(1100,400));
+#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
QCOMPARE_NE(converter.zoom(), oldZoom);
QCOMPARE_NE(converter.documentOffsetF(), oldOffset);
+#else
+ QVERIFY(!qFuzzyCompare(converter.zoom(), oldZoom));
+ QVERIFY(converter.documentOffsetF() != oldOffset);
+#endif
// update the expected still point to the ceter of the "new" widget
expectedStillPoint.second = converter.widgetCenterPoint();