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: Fix saving incremental version/backup

Freya Lupenc50d034f64e9
diff --git a/libs/ui/KisViewManager.cpp b/libs/ui/KisViewManager.cpp
index 8a3d8506d6..c3b4b4fa6f 100644
--- a/libs/ui/KisViewManager.cpp
+++ b/libs/ui/KisViewManager.cpp
@@ -1053,7 +1053,7 @@ void KisViewManager::slotSaveIncremental()
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
fileName.replace(regex2, extensionPlusVersion);
#else
- regex2.replaceIn(fileName, extensionPlusVersion);
+ fileName = regex2.replaceIn(fileName, extensionPlusVersion);
#endif
}
@@ -1078,7 +1078,7 @@ void KisViewManager::slotSaveIncremental()
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
fileName.replace(regex, newVersion);
#else
- regex.replaceIn(fileName, newVersion);
+ fileName = regex.replaceIn(fileName, newVersion);
#endif
fileAlreadyExists = QFileInfo(path + '/' + fileName).exists();
if (fileAlreadyExists) {
@@ -1162,7 +1162,7 @@ void KisViewManager::slotSaveIncrementalBackup()
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
backupFileName.replace(regex, newVersion);
#else
- regex.replaceIn(backupFileName, newVersion);
+ backupFileName = regex.replaceIn(backupFileName, newVersion);
#endif
fileAlreadyExists = QFile(path + '/' + backupFileName).exists();
if (fileAlreadyExists) {
@@ -1197,7 +1197,7 @@ void KisViewManager::slotSaveIncrementalBackup()
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
backupFileName.replace(regex2, extensionPlusVersion);
#else
- regex2.replaceIn(backupFileName, extensionPlusVersion);
+ backupFileName = regex2.replaceIn(backupFileName, extensionPlusVersion);
#endif
// Save version with 1 number higher than the highest version found ignoring letters
@@ -1208,7 +1208,7 @@ void KisViewManager::slotSaveIncrementalBackup()
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
backupFileName.replace(regex, newVersion);
#else
- regex.replaceIn(backupFileName, newVersion);
+ backupFileName = regex.replaceIn(backupFileName, newVersion);
#endif
fileAlreadyExists = QFile(path + '/' + backupFileName).exists();
if (fileAlreadyExists) {
diff --git a/libs/ui/widgets/kis_floating_message.cpp b/libs/ui/widgets/kis_floating_message.cpp
index 7d1a1fb551..04e51ee64a 100644
--- a/libs/ui/widgets/kis_floating_message.cpp
+++ b/libs/ui/widgets/kis_floating_message.cpp
@@ -174,11 +174,11 @@ QRect KisFloatingMessage::determineMetrics( const int M )
#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");
+ m_message = r.replaceIn(m_message, "\n");
// remove consecutive line breaks
QRegExp r2(( "\n+"));
- r2.replaceIn(m_message, "\n");
+ m_message = r2.replaceIn(m_message, "\n");
#endif
// The osd cannot be larger than the screen
diff --git a/plugins/tools/svgtexttool/SvgTextInsertCommand.cpp b/plugins/tools/svgtexttool/SvgTextInsertCommand.cpp
index f3a12fa27d..a34ae64341 100644
--- a/plugins/tools/svgtexttool/SvgTextInsertCommand.cpp
+++ b/plugins/tools/svgtexttool/SvgTextInsertCommand.cpp
@@ -34,7 +34,7 @@ SvgTextInsertCommand::SvgTextInsertCommand(KoSvgTextShape *shape, int pos, int a
#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
text.replace(exp, "\n");
#else
- exp.replaceIn(text, "\n");
+ text = exp.replaceIn(text, "\n");
#endif
m_text = text;
}