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++

Add documentation for the glyph palette classes.

Wolthera van Hövell tot Westerflierc3b484725e60
diff --git a/plugins/tools/svgtexttool/SvgTextTool.h b/plugins/tools/svgtexttool/SvgTextTool.h
index 697ebb4b78..e6a7399d79 100644
--- a/plugins/tools/svgtexttool/SvgTextTool.h
+++ b/plugins/tools/svgtexttool/SvgTextTool.h
@@ -112,8 +112,22 @@ private Q_SLOTS:
void slotTextEditorClosed();
void textUpdated(KoSvgTextShape *shape, const QString &svg, const QString &defs);
+ /**
+ * @brief showGlyphPalette
+ * Shows the glyph palette dialog.
+ */
void showGlyphPalette();
+ /**
+ * @brief updateGlyphPalette
+ * update the glyph palette dialog from the current selection.
+ */
void updateGlyphPalette();
+ /**
+ * @brief insertRichText
+ * Insert a rich text shape, used by the glyph palette..
+ * @param richText -- rich text shape.
+ * @param replaceLastGlyph -- whether to replace the last glyph or to fully insert.
+ */
void insertRichText(KoSvgTextShape *richText, bool replaceLastGlyph = false);
/**
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.h b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.h
index 1652c0020b..51520e92e8 100644
--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.h
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.h
@@ -17,6 +17,13 @@
#include "GlyphPaletteProxyModel.h"
#include "GlyphPaletteAltPopup.h"
+/**
+ * @brief The GlyphPaletteDialog class
+ *
+ * This dialog holds the glyph palette/character map for a given
+ * font. It can show both the alternate glyphs for the current text,
+ * and show a character map with selectable glyph alternates.
+ */
class GlyphPaletteDialog: public KoDialog
{
Q_OBJECT
@@ -24,6 +31,12 @@ public:
GlyphPaletteDialog(QWidget *parent = nullptr);
~GlyphPaletteDialog();
+ /**
+ * @brief setGlyphModelFromProperties
+ * This updates the glyph model.
+ * @param properties -- text properties, first is non-inherited, second is inherited.
+ * @param text -- the current text to display alternate glyphs for.
+ */
void setGlyphModelFromProperties(const QPair<KoSvgTextProperties, KoSvgTextProperties> &properties, const QString &text);
Q_SIGNALS:
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteProxyModel.h b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteProxyModel.h
index 0fa9a8c921..15a073ddea 100644
--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteProxyModel.h
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteProxyModel.h
@@ -10,7 +10,13 @@
#include <QSortFilterProxyModel>
#include <KoFontGlyphModel.h>
#include <QChar>
-
+/**
+ * @brief The GlyphPaletteProxyModel class
+ *
+ * This class is a filter model for the KoFontGlyphModel,
+ * which allows it to be used as a character map, allowing
+ * filtering on blocks and strings.
+ */
class GlyphPaletteProxyModel: public QSortFilterProxyModel
{
Q_OBJECT
@@ -22,15 +28,44 @@ public:
GlyphPaletteProxyModel(QObject *parent = nullptr);
~GlyphPaletteProxyModel() override;
+ /**
+ * @brief blockFilter
+ * @return current blockfilter, value is value in blockLabels.
+ */
int blockFilter() const;
+
+ /**
+ * @brief searchText
+ * @return current search text. This is a single unicode codepoint.
+ */
QString searchText() const;
+ /**
+ * @brief blockLabels
+ * @return list of unicode block filter labels, with each entry representing
+ * a QVariantMap with a "name" and a "value"
+ */
QVariantList blockLabels() const;
public Q_SLOTS:
+ /**
+ * @brief setSearchText
+ * @param text -- if the text starts with "U+", the consequetive characters are interpreted as a hex value.
+ * Otherwise, the first codepoint of text is searched upon.
+ */
void setSearchText(const QString &text);
+ /**
+ * @brief setBlockFilter
+ * set the unicode block filter.
+ * @param filter -- value from blockLabels();
+ */
void setBlockFilter(int filter);
+ /**
+ * @brief emitBlockLabelsChanged
+ * This called "block labels changed" and is should be used when the source KoFontGlyphModel changes,
+ * so that the unicode block filter list is updated to the new font.
+ */
void emitBlockLabelsChanged();
Q_SIGNALS: