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 some minor issues and typoes.
Wolthera van Hövell tot Westerfliere0d8a4ac1a18
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml b/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qmlindex 3f87c1a245..9ad62c0194 100644--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml@@ -56,6 +56,7 @@ Rectangle {GlyphPaletteAlts {id: glyphAlts;glyphModel: root.model;+ useCharMap: false;fontFamilies: root.fontFamilies;fontSize: root.fontSize;fontWeight: root.fontWeight;@@ -148,7 +149,7 @@ Rectangle {fontSlant: root.fontSlant;fontAxesValues: root.fontAxesValues === undefined? {}: root.fontAxesValues;onGlyphDoubleClicked: (index, mouse)=> {- mainWindow.slotInsertRichText(index)+ mainWindow.slotInsertRichText(index, -1, false, true)};onGlyphClicked: (index, mouse)=> {if (model.childCount > 1){diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.cpp b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.cppindex 09280b6276..cf85bd684e 100644--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.cpp+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.cpp@@ -79,6 +79,7 @@ void GlyphPaletteAltPopup::setModel(QAbstractItemModel *model)m_charMapModel = model;if (m_quickWidget->rootObject() && m_charMapModel) {m_quickWidget->rootObject()->setProperty("glyphModel", QVariant::fromValue(m_charMapModel));+ m_quickWidget->rootObject()->setProperty("useCharMap", QVariant::fromValue(true));}}@@ -95,7 +96,7 @@ void GlyphPaletteAltPopup::setMarkup(const QStringList &families, const int size}}-void GlyphPaletteAltPopup::slotInsertRichText(const int charRow, const int glyphRow, const bool replace)+void GlyphPaletteAltPopup::slotInsertRichText(const int charRow, const int glyphRow, const bool replace, const bool useCharMap){- emit sigInsertRichText(charRow, glyphRow, replace);+ emit sigInsertRichText(charRow, glyphRow, replace, useCharMap);}diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.h b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.hindex 52c35aea62..92747eac3c 100644--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.h+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.h@@ -50,9 +50,9 @@ public:public Q_SLOTS:- void slotInsertRichText(const int charRow, const int glyphRow = -1, const bool replace = false);+ void slotInsertRichText(const int charRow, const int glyphRow = -1, const bool replace = false, const bool useCharMap = false);Q_SIGNALS:- void sigInsertRichText(int charRow, int glyphRow, bool replace);+ void sigInsertRichText(int charRow, int glyphRow, bool replace, bool useCharMap);private:QQuickWidget *m_quickWidget {0};QAbstractItemModel *m_charMapModel {0};diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAlts.qml b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAlts.qmlindex 0d63caf0a4..6fad7eb038 100644--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAlts.qml+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAlts.qml@@ -9,6 +9,7 @@ Rectangle {property int parentIndex: 0;property int columns: 8;property bool replace: false;+ property bool useCharMap: true;property var fontFamilies: [];property double fontSize: 10.0;@@ -52,10 +53,10 @@ Rectangle {language: root.language;onGlyphClicked: (index, mouse)=> {if (!root.replace) {- mainWindow.slotInsertRichText(root.parentIndex, index, root.replace)+ mainWindow.slotInsertRichText(root.parentIndex, index, root.replace, root.useCharMap)}};- onGlyphDoubleClicked: (index, mouse)=> {mainWindow.slotInsertRichText(root.parentIndex, index, root.replace)};+ onGlyphDoubleClicked: (index, mouse)=> {mainWindow.slotInsertRichText(root.parentIndex, index, root.replace, root.useCharMap)};}}focus: true;diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cppindex f27a564d34..89bcf96035 100644--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp@@ -58,7 +58,7 @@ GlyphPaletteDialog::GlyphPaletteDialog(QWidget *parent)if (!m_quickWidget->errors().empty()) {qWarning() << "Errors in " << windowTitle() << ":" << m_quickWidget->errors();}- connect(m_altPopup, SIGNAL(sigInsertRichText(int,int,bool)), this, SLOT(slotInsertRichText(int,int,bool)));+ connect(m_altPopup, SIGNAL(sigInsertRichText(int,int,bool,bool)), this, SLOT(slotInsertRichText(int,int,bool,bool)));}GlyphPaletteDialog::~GlyphPaletteDialog()@@ -75,10 +75,10 @@ GlyphPaletteDialog::~GlyphPaletteDialog()void GlyphPaletteDialog::setGlyphModelFromProperties(const QPair<KoSvgTextProperties, KoSvgTextProperties> &properties, const QString &text){- if (m_lastUsedProperties.property(KoSvgTextProperties::FontFamiliesId) == properties.first.property(KoSvgTextProperties::FontFamiliesId)- && m_lastUsedProperties.property(KoSvgTextProperties::FontWeightId) == properties.first.property(KoSvgTextProperties::FontWeightId)- && m_lastUsedProperties.property(KoSvgTextProperties::FontStyleId) == properties.first.property(KoSvgTextProperties::FontStyleId)- && m_lastUsedProperties.property(KoSvgTextProperties::FontStretchId) == properties.first.property(KoSvgTextProperties::FontStretchId)) {+ if (m_lastUsedProperties.second.property(KoSvgTextProperties::FontFamiliesId) == properties.second.property(KoSvgTextProperties::FontFamiliesId)+ && m_lastUsedProperties.second.property(KoSvgTextProperties::FontWeightId) == properties.second.property(KoSvgTextProperties::FontWeightId)+ && m_lastUsedProperties.second.property(KoSvgTextProperties::FontStyleId) == properties.second.property(KoSvgTextProperties::FontStyleId)+ && m_lastUsedProperties.second.property(KoSvgTextProperties::FontStretchId) == properties.second.property(KoSvgTextProperties::FontStretchId)) {if (m_model && m_model->rowCount() > 0) {if (text.isEmpty()) return;QModelIndex idx = m_model->indexForString(text);@@ -130,7 +130,7 @@ void GlyphPaletteDialog::setGlyphModelFromProperties(const QPair<KoSvgTextProperm_quickWidget->rootObject()->setProperty("fontWeight", QVariant::fromValue(weight));m_quickWidget->rootObject()->setProperty("fontWidth", QVariant::fromValue(width));m_quickWidget->rootObject()->setProperty("fontStyle", QVariant::fromValue(style.style));- m_quickWidget->rootObject()->setProperty("fontAxesValues", QVariant::fromValue(axes));+ m_quickWidget->rootObject()->setProperty("fontAxesValues", QVariant::fromValue(map));m_quickWidget->rootObject()->setProperty("language", QVariant::fromValue(language));if (idx.isValid()) {m_quickWidget->rootObject()->setProperty("currentIndex", QVariant::fromValue(idx.row()));@@ -139,27 +139,22 @@ void GlyphPaletteDialog::setGlyphModelFromProperties(const QPair<KoSvgTextProperif (m_altPopup) {m_altPopup->setMarkup(families, size, weight, width, style.style, map, language);}- m_lastUsedProperties = properties.first;+ m_lastUsedProperties = properties;}-void GlyphPaletteDialog::slotInsertRichText(const int charRow, const int glyphRow, const bool replace)+void GlyphPaletteDialog::slotInsertRichText(const int charRow, const int glyphRow, const bool replace, const bool useCharMap){if (m_quickWidget->rootObject()) {- QModelIndex idx = replace? m_model->index(charRow, 0): m_charMapModel->index(charRow, 0);- QString text = idx.isValid()? m_model->data(idx, Qt::DisplayRole).toString(): QString();- KoSvgTextProperties props = m_lastUsedProperties;+ QAbstractItemModel *model = useCharMap? qobject_cast<QAbstractItemModel*>(m_charMapModel): qobject_cast<QAbstractItemModel*>(m_model);+ QModelIndex idx = model->index(charRow, 0);+ QString text = idx.isValid()? model->data(idx, Qt::DisplayRole).toString(): QString();+ KoSvgTextProperties props = m_lastUsedProperties.first;QStringList otf;if (glyphRow > -1) {- if (replace) {- idx = m_model->index(glyphRow, 0, idx);- text = m_model->data(idx, Qt::DisplayRole).toString();- otf.append(m_model->data(idx, KoFontGlyphModel::OpenTypeFeatures).value<QStringList>());- } else {- idx = m_charMapModel->index(glyphRow, 0, idx);- text = m_charMapModel->data(idx, Qt::DisplayRole).toString();- otf.append(m_charMapModel->data(idx, KoFontGlyphModel::OpenTypeFeatures).value<QStringList>());- }+ idx = model->index(glyphRow, 0, idx);+ text = model->data(idx, Qt::DisplayRole).toString();+ otf.append(model->data(idx, KoFontGlyphModel::OpenTypeFeatures).value<QStringList>());}if (!text.isEmpty()) {diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.h b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.hindex 51520e92e8..bff1a911cb 100644--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.h+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.h@@ -43,7 +43,7 @@ Q_SIGNALS:void signalInsertRichText(KoSvgTextShape *text, bool replace);public Q_SLOTS:- void slotInsertRichText(const int charRow, const int glyphRow = -1, const bool replace = false);+ void slotInsertRichText(const int charRow, const int glyphRow = -1, const bool replace = false, const bool useCharMap = false);// Show the glyphalts for charRow in a pop-up located at x, y. Make sure to adjust cell-size.void slotShowPopupPalette(const int charRow, const int x = 0, const int y = 0, const int cellWidth = 100, const int cellHeight = 100);void slotHidePopupPalette();@@ -51,7 +51,7 @@ public Q_SLOTS:private:QQuickWidget *m_quickWidget {0};GlyphPaletteAltPopup *m_altPopup {0};- KoSvgTextProperties m_lastUsedProperties;+ QPair<KoSvgTextProperties, KoSvgTextProperties> m_lastUsedProperties;KoFontGlyphModel *m_model;GlyphPaletteProxyModel *m_charMapModel;};