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++
Use createIndex in KoFontGlyphModel::parent() function.
Wolthera van Hövell tot Westerflieraab84bcbf447
diff --git a/libs/flake/text/KoFontGlyphModel.cpp b/libs/flake/text/KoFontGlyphModel.cppindex 6014017881..1ecb57a2e2 100644--- a/libs/flake/text/KoFontGlyphModel.cpp+++ b/libs/flake/text/KoFontGlyphModel.cpp@@ -414,11 +414,11 @@ QVariant KoFontGlyphModel::data(const QModelIndex &index, int role) constQModelIndex KoFontGlyphModel::index(int row, int column, const QModelIndex &parent) const{- //qDebug() << Q_FUNC_INFO << row << column << parent;if (parent.isValid() && parent.row() >= 0 && parent.row() < d->codePoints.size()) {Private::CodePointInfo info = d->codePoints.at(parent.row());if (row >= 0 && row < info.glyphs.size()) {- return createIndex(row, column, &info.glyphs[row]);+ Private::GlyphInfo glyphInfo = info.glyphs.at(row);+ return createIndex(row, column, &glyphInfo);}} else if (row >= 0 && row < d->codePoints.size()) {@@ -433,13 +433,13 @@ QModelIndex KoFontGlyphModel::parent(const QModelIndex &child) constreturn QModelIndex();}Private::InfoNode *node = static_cast<Private::InfoNode*>(child.internalPointer());-- if (node) {- const uint targetUcs = node->ucs;+ Private::GlyphInfo *glyphInfo = dynamic_cast<Private::GlyphInfo*>(node);+ if (glyphInfo) {+ const uint targetUcs = glyphInfo->ucs;for(int i = 0; i < d->codePoints.size(); i++) {Private::CodePointInfo info = d->codePoints.at(i);if (info.ucs == targetUcs) {- return index(i, 0, QModelIndex());+ return createIndex(i, 0);}}}