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

Ensure that the glyph palette has a proper message when the index is invalid.

Wolthera van Hövell tot Westerflier75a8266eae4e
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAlts.qml b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAlts.qml
index 4a7b6e62c2..d9f3f4359e 100644
--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAlts.qml
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAlts.qml
@@ -38,14 +38,16 @@ Control {
GridView {
anchors.fill: parent;
+ visible: root.parentIndex >= 0;
+
model: DelegateModel {
id: glyphAltModel
model: root.glyphModel;
property alias parentIndex: root.parentIndex;
- property var defaultIndex: modelIndex(-1);
+
onParentIndexChanged: {
// This first line is necessary to reset the model to the root of the glyph model.
- rootIndex = defaultIndex;
+ rootIndex = parentModelIndex();
rootIndex = modelIndex(root.parentIndex);
}
@@ -77,4 +79,10 @@ Control {
id: glyphAltScroll;
}
}
+
+ Label {
+ anchors.fill: parent;
+ text: i18nc("@info", "No glyph alternates available.");
+ visible: root.parentIndex < 0;
+ }
}
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp
index a729b6b8c4..974d612164 100644
--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp
@@ -89,9 +89,8 @@ void GlyphPaletteDialog::setGlyphModelFromProperties(const QPair<KoSvgTextProper
m_quickWidget->rootObject()->setProperty("fontStyle", QVariant::fromValue(info.slantMode));
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()));
- }
+
+ m_quickWidget->rootObject()->setProperty("currentIndex", QVariant::fromValue(idx.isValid()? idx.row(): -1));
}
if (m_altPopup) {
m_altPopup->setMarkup(info.families, info.size, info.weight, info.width, info.slantMode, map, language);