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 the usage of QPair in the new text tool

Dmitry Kazakov58e16dccbfd0
diff --git a/libs/flake/text/KoCssTextUtils.cpp b/libs/flake/text/KoCssTextUtils.cpp
index 6bde694f5b..054983ba41 100644
--- a/libs/flake/text/KoCssTextUtils.cpp
+++ b/libs/flake/text/KoCssTextUtils.cpp
@@ -20,12 +20,12 @@ QVector<QPair<int, int>> positionDifference(QStringList a, QStringList b) {
if (textA.size() > textB.size()) {
for (int j=0; j < textA.size(); j++) {
int k = j < textB.size()? countB+j: -1;
- positions.append(QPair(countA+j, k));
+ positions.append(qMakePair(countA+j, k));
}
} else {
for (int j=0; j < textB.size(); j++) {
int k = j < textA.size()? countA+j: -1;
- positions.append(QPair(k, countB+j));
+ positions.append(qMakePair(k, countB+j));
}
}
countA += textA.size();
diff --git a/libs/flake/text/KoSvgTextShape_p_layout.cpp b/libs/flake/text/KoSvgTextShape_p_layout.cpp
index ec83d3cfdf..e10558b1e1 100644
--- a/libs/flake/text/KoSvgTextShape_p_layout.cpp
+++ b/libs/flake/text/KoSvgTextShape_p_layout.cpp
@@ -173,10 +173,10 @@ void KoSvgTextShape::Private::relayout()
QString plainText;
Q_FOREACH (const SubChunk &chunk, textChunks) {
for (int i = 0; i < chunk.newToOldPositions.size(); i++) {
- QPair pos = chunk.newToOldPositions.at(i);
+ QPair<int, int> pos = chunk.newToOldPositions.at(i);
int a = pos.second < 0? -1: text.size()+pos.second;
int b = pos.first < 0? -1: plainText.size()+pos.first;
- QPair newPos = QPair<int, int> (a, b);
+ QPair<int, int> newPos = QPair<int, int> (a, b);
clusterToOriginalString.append(newPos);
}
text.append(chunk.text);
@@ -225,7 +225,7 @@ void KoSvgTextShape::Private::relayout()
}
}
for (int i=0; i < clusterToOriginalString.size(); i++) {
- QPair mapping = clusterToOriginalString.at(i);
+ QPair<int, int> mapping = clusterToOriginalString.at(i);
if (mapping.first < 0) {
continue;
} else {