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++
Add abillity to search glyphs in glyph palette with unicode hex code.
Wolthera van Hövell tot Westerflier440d8653c392
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml b/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qmlindex 4784b7f2dd..e3f995a6b1 100644--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml@@ -127,9 +127,15 @@ Rectangle {root.charMapModel.searchText = text;}placeholderText: i18nc("@info:placeholder", "Search...");+ hoverEnabled: true;Layout.fillWidth: true;Layout.preferredHeight: implicitHeight;padding: 5;++ ToolTip.text: i18nc("@info:tooltip",+ "Searches for characters that match the first letter of the string. Hex search is possible when prepended with \"U+\", (for example, U+0045 will search for 'E')");+ ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval+ ToolTip.visible: hovered;}GridView {diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteProxyModel.cpp b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteProxyModel.cppindex d1e1393866..ce7e48f1db 100644--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteProxyModel.cpp+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteProxyModel.cpp@@ -51,10 +51,18 @@ QVariantList GlyphPaletteProxyModel::blockLabels() constvoid GlyphPaletteProxyModel::setSearchText(const QString &text){- if (!d->searchText.isEmpty() && !text.isEmpty() && d->searchText.toUcs4().first() == text.toUcs4().first()) {+ QString adjustedText = text;+ if (text.startsWith("U+")) {+ bool ok = false;+ const uint code = text.mid(2).toUInt(&ok, 16);+ if (ok) {+ adjustedText = QString::fromUcs4(&code, 1);+ }+ }+ if (!d->searchText.isEmpty() && !adjustedText.isEmpty() && d->searchText.toUcs4().first() == adjustedText.toUcs4().first()) {return;} else {- d->searchText = text.isEmpty()? text: QString::fromUcs4(&text.toUcs4().first(), 1);+ d->searchText = adjustedText.isEmpty()? adjustedText: QString::fromUcs4(&adjustedText.toUcs4().first(), 1);emit searchTextChanged();invalidateFilter();}