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++
Replace forgotten NodeEditor->NodeIndex
Dmitry Kazakovb1062200679d
diff --git a/libs/flake/resources/KoCssStylePreset.cpp b/libs/flake/resources/KoCssStylePreset.cppindex 45d8b02799..02a3751403 100644--- a/libs/flake/resources/KoCssStylePreset.cpp+++ b/libs/flake/resources/KoCssStylePreset.cpp@@ -422,7 +422,7 @@ bool KoCssStylePreset::loadFromDevice(QIODevice *dev, KisResourcesInterfaceSP reif (textShape) {setName(textShape->additionalAttribute(TITLE));addMetaData(DESCRIPTION, textShape->additionalAttribute(DESC));- KoSvgTextNodeIndex node = textShape->findNodeEditorForPropertyId(KoSvgTextProperties::KraTextStyleType);+ KoSvgTextNodeIndex node = textShape->findNodeIndexForPropertyId(KoSvgTextProperties::KraTextStyleType);QString styleType = STYLE_TYPE_PARAGRAPH;if (node.properties()) {KoSvgTextProperties props = *(node.properties());diff --git a/libs/flake/tests/TestSvgText.cpp b/libs/flake/tests/TestSvgText.cppindex f73bab9976..b97b96803b 100644--- a/libs/flake/tests/TestSvgText.cpp+++ b/libs/flake/tests/TestSvgText.cpp@@ -3146,7 +3146,7 @@ void TestSvgText::testSearchingTreeIndex()KoSvgTextShapeMarkupConverter converter(textShape);converter.convertFromSvg(ref, QString(), QRectF(0, 0, 300, 300), 72.0);- KoSvgTextNodeIndex node = textShape->findNodeEditorForPropertyId(KoSvgTextProperties::FontStyleId);+ KoSvgTextNodeIndex node = textShape->findNodeIndexForPropertyId(KoSvgTextProperties::FontStyleId);QVERIFY(node.properties());}@@ -3163,7 +3163,7 @@ void TestSvgText::testRangeForTreeIndex()KoSvgTextShapeMarkupConverter converter(textShape);converter.convertFromSvg(ref, QString(), QRectF(0, 0, 300, 300), 72.0);- KoSvgTextNodeIndex node = textShape->findNodeEditorForPropertyId(KoSvgTextProperties::FontStyleId);+ KoSvgTextNodeIndex node = textShape->findNodeIndexForPropertyId(KoSvgTextProperties::FontStyleId);QPair<int, int> range = textShape->findRangeForNodeIndex(node);QCOMPARE(range.first, 10);@@ -3182,7 +3182,7 @@ void TestSvgText::testSetPropertiesOnTreeIndex()KoSvgTextShapeMarkupConverter converter(textShape);converter.convertFromSvg(ref, QString(), QRectF(0, 0, 300, 300), 72.0);- KoSvgTextNodeIndex node = textShape->findNodeEditorForPropertyId(KoSvgTextProperties::FontStyleId);+ KoSvgTextNodeIndex node = textShape->findNodeIndexForPropertyId(KoSvgTextProperties::FontStyleId);QVERIFY(node.properties()->hasProperty(KoSvgTextProperties::FontStyleId));diff --git a/libs/flake/text/KoSvgTextShape.cpp b/libs/flake/text/KoSvgTextShape.cppindex c149ec42a6..a1f3c197c5 100644--- a/libs/flake/text/KoSvgTextShape.cpp+++ b/libs/flake/text/KoSvgTextShape.cpp@@ -1099,12 +1099,12 @@ void KoSvgTextShape::cleanUp()shapeChangedPriv(ContentChanged);}-KisForest<KoSvgTextContentElement>::child_iterator findNodeEditorForPropertyIdImpl(KisForest<KoSvgTextContentElement>::child_iterator parent, KoSvgTextProperties::PropertyId propertyId) {+KisForest<KoSvgTextContentElement>::child_iterator findNodeIndexForPropertyIdImpl(KisForest<KoSvgTextContentElement>::child_iterator parent, KoSvgTextProperties::PropertyId propertyId) {for (auto child = KisForestDetail::childBegin(parent); child != KisForestDetail::childEnd(parent); child++) {if (child->properties.hasProperty(propertyId)) {return child;} else if (KisForestDetail::childBegin(child) != KisForestDetail::childEnd(child)) {- auto found = findNodeEditorForPropertyIdImpl(child, propertyId);+ auto found = findNodeIndexForPropertyIdImpl(child, propertyId);if (found != child) {return found;}@@ -1113,13 +1113,13 @@ KisForest<KoSvgTextContentElement>::child_iterator findNodeEditorForPropertyIdImreturn parent;}-KoSvgTextNodeIndex KoSvgTextShape::findNodeEditorForPropertyId(KoSvgTextProperties::PropertyId propertyId)+KoSvgTextNodeIndex KoSvgTextShape::findNodeIndexForPropertyId(KoSvgTextProperties::PropertyId propertyId){for (auto it = d->textData.childBegin(); it != d->textData.childEnd(); it++) {if (it->properties.hasProperty(propertyId)) {return Private::createTextNodeIndex(it);} else if (KisForestDetail::childBegin(it) != KisForestDetail::childEnd(it)) {- auto found = findNodeEditorForPropertyIdImpl(it, propertyId);+ auto found = findNodeIndexForPropertyIdImpl(it, propertyId);if (found != it) {return Private::createTextNodeIndex(found);}diff --git a/libs/flake/text/KoSvgTextShape.h b/libs/flake/text/KoSvgTextShape.hindex 3dccbb9716..05b8be362a 100644--- a/libs/flake/text/KoSvgTextShape.h+++ b/libs/flake/text/KoSvgTextShape.h@@ -374,26 +374,26 @@ public:void cleanUp();/*****************************************************************************- * KoSvgTextNodeEditor functions.+ * KoSvgTextNodeIndex functions.** SVG Text is internally a tree of nodes, with each node having text* properties, and the child nodes furthest from the root having text content.* While we can access the latter by using ranges, and we can easily access* the root node by using -1, there's no way to access the nodes that may- * be inbetween. KoSvgTextNodeEditor allows accessing these nodes.+ * be inbetween. KoSvgTextNodeIndex allows accessing these nodes.*****************************************************************************//**- * @brief findNodeEditorForPropertyId- * @return the nodeEditor of the first content element found with a given property id.+ * @brief findNodeIndexForPropertyId+ * @return the nodeIndex of the first content element found with a given property id.* @propertyId -- id to search for.*/- KoSvgTextNodeIndex findNodeEditorForPropertyId(KoSvgTextProperties::PropertyId propertyId);+ KoSvgTextNodeIndex findNodeIndexForPropertyId(KoSvgTextProperties::PropertyId propertyId);/**- * @brief findRangeForNodeEditor- * Find the start and end cursor position for a given nodeEditor.+ * @brief findRangeForNodeIndex+ * Find the start and end cursor position for a given nodeIndex.* @param node the tree index to find the range for.* @return A QPair<int,int> describing cursor position range encompassed by the tree index and it's children.* Will return {-1, -1} when the tree index is invalid.@@ -556,7 +556,7 @@ private:};/**- * @brief The KoSvgTextNodeEditor class+ * @brief The KoSvgTextNodeIndex class** Because SVG text is a tree, it is not always* possible to edit nodes by range. This class can