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: invert string/qregexp application

Halla Rempt63d5fa1934bc
diff --git a/libs/ui/widgets/kis_floating_message.cpp b/libs/ui/widgets/kis_floating_message.cpp
index a1f7d4c4bf..4b182086e7 100644
--- a/libs/ui/widgets/kis_floating_message.cpp
+++ b/libs/ui/widgets/kis_floating_message.cpp
@@ -167,11 +167,20 @@ QRect KisFloatingMessage::determineMetrics( const int M )
else {
max = QSize(1024, 768);
}
-
+#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
// If we don't do that, the boundingRect() might not be suitable for drawText() (Qt issue N67674)
m_message.replace(QRegExp( " +\n"), "\n");
// remove consecutive line breaks
m_message.replace(QRegExp( "\n+"), "\n");
+#else
+ // If we don't do that, the boundingRect() might not be suitable for drawText() (Qt issue N67674)
+ QRegExp r(" +\n");
+ r.replaceIn(m_message, "\n");
+
+ // remove consecutive line breaks
+ QRegExp r2(( "\n+"));
+ r2.replaceIn(m_message, "\n");
+#endif
// The osd cannot be larger than the screen
QRect rect = fontMetrics().boundingRect(0, 0, max.width() - image.width(), max.height(),