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

Move the character map glyph alternates into a QWidget pop-up for better UX.

Wolthera van Hövell tot Westerflier540717b7a220
diff --git a/plugins/tools/svgtexttool/CMakeLists.txt b/plugins/tools/svgtexttool/CMakeLists.txt
index 9e12ae392b..f1399a8a18 100644
--- a/plugins/tools/svgtexttool/CMakeLists.txt
+++ b/plugins/tools/svgtexttool/CMakeLists.txt
@@ -27,6 +27,7 @@ set (SvgTextTool_SRCS
glyphpalette/GlyphPaletteDialog.cpp
glyphpalette/GlyphPaletteProxyModel.cpp
glyphpalette/SvgTextLabel.cpp
+ glyphpalette/GlyphPaletteAltPopup.cpp
)
ki18n_wrap_ui(SvgTextTool_SRCS
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphDelegate.qml b/plugins/tools/svgtexttool/glyphpalette/GlyphDelegate.qml
index d22a8cc3df..87dd4ec19e 100644
--- a/plugins/tools/svgtexttool/glyphpalette/GlyphDelegate.qml
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphDelegate.qml
@@ -14,13 +14,15 @@ SvgTextLabel {
padding: height/8;
clip: true;
+ property alias hovered: glyphMouseArea.containsMouse;
+
width: GridView.view.cellWidth;
height: GridView.view.cellHeight;
property bool currentItem: GridView.isCurrentItem;
- signal glyphClicked(int index);
- signal glyphDoubleClicked(int index);
+ signal glyphClicked(int index, int posX, int posY);
+ signal glyphDoubleClicked(int index, int posX, int posY);
Rectangle {
anchors.fill: parent;
@@ -42,7 +44,7 @@ SvgTextLabel {
color: sysPalette.base;
font.pointSize: 9;
}
- visible: glyphMouseArea.containsMouse;
+ visible: parent.hovered;
}
Rectangle {
anchors.top: parent.top;
@@ -50,7 +52,7 @@ SvgTextLabel {
width: 8;
height: 8;
radius: 4;
- color: sysPalette.text;
+ color: parent.textColor;
opacity: 0.3;
visible: model.childCount > 1;
}
@@ -60,11 +62,11 @@ SvgTextLabel {
id: glyphMouseArea
onClicked: {
parent.GridView.view.currentIndex = index;
- glyphClicked(index);
+ glyphClicked(index, mouseX, mouseY);
}
onDoubleClicked: {
parent.GridView.view.currentIndex = index;
- glyphDoubleClicked(index);
+ glyphDoubleClicked(index, mouseX, mouseY);
}
hoverEnabled: true;
ToolTip.text: model.toolTip;
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml b/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml
index e3f995a6b1..a5b0d7053d 100644
--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPalette.qml
@@ -15,11 +15,13 @@ Rectangle {
property QtObject model: glyphModel;
property GlyphPaletteProxyModel charMapModel: charMapProxyModel;
- property int currentIndex: 0;
+ property alias currentIndex: glyphAlts.parentIndex;
property var fontFamilies: [];
property double fontSize :10.0;
- property int fontWeight : 400;
- property int fontStyle;
+ property double fontWeight : 400;
+ property double fontWidth : 100;
+ property int fontStyle: 0;
+ property double fontSlant: 0.0;
SystemPalette {
id: sysPalette;
colorGroup: SystemPalette.Active
@@ -49,43 +51,23 @@ Rectangle {
anchors.top: tabs.bottom;
anchors.bottom: parent.bottom;
// Glyph alts.
- GridView {
+ GlyphPaletteAlts {
id: glyphAlts;
- model: DelegateModel {
- id: glyphAltModel
- model: root.model;
- property alias rIndex: root.currentIndex;
- property var defaultIndex: modelIndex(-1);
- onRIndexChanged: {
- // This first line is necessary to reset the model to the root index.
- rootIndex = defaultIndex;
- rootIndex = modelIndex(root.currentIndex);
- }
-
- delegate: GlyphDelegate {
- textColor: sysPalette.text;
- fillColor: sysPalette.base;
- fontFamilies: root.fontFamilies;
- fontSize: root.fontSize;
- fontStyle: root.fontStyle;
- fontWeight: root.fontWeight;
- onGlyphDoubleClicked: (index)=> {mainWindow.slotInsertRichText(root.currentIndex, index, true)};
- }
- }
- focus: true;
- clip: true;
-
- cellWidth: (parent.width - glyphAltScroll.implicitBackgroundWidth)/8;
- cellHeight: cellWidth;
-
- ScrollBar.vertical: ScrollBar {
- id: glyphAltScroll;
- }
-
+ glyphModel: root.model;
+ fontFamilies: root.fontFamilies;
+ fontSize: root.fontSize;
+ fontWeight: root.fontWeight;
+ fontStyle: root.fontStyle;
+ fontWidth: root.fontWidth;
+ fontSlant: root.fontSlant;
+ replace: true;
+ Layout.fillHeight: true;
+ Layout.fillWidth: true;
}
// Charmap.
RowLayout {
+ id: charMapLayout;
Layout.fillHeight: true;
Layout.fillWidth: true;
spacing: 1;
@@ -115,6 +97,7 @@ Rectangle {
}
ColumnLayout {
+ id: rightSide;
Layout.minimumWidth: 180;
Layout.fillHeight: true;
Layout.fillWidth: true;
@@ -150,16 +133,17 @@ Rectangle {
cellHeight: cellWidth;
delegate: GlyphDelegate {
- textColor: sysPalette.text;
- fillColor: sysPalette.base;
+ textColor: hovered? sysPalette.highlightedText: sysPalette.text;
+ fillColor: hovered? sysPalette.highlight: sysPalette.base;
fontFamilies: root.fontFamilies;
fontSize: root.fontSize;
fontStyle: root.fontStyle;
fontWeight: root.fontWeight;
- onGlyphDoubleClicked: (index)=> {mainWindow.slotInsertRichText(index)};
- onGlyphClicked: (index)=> {
+ onGlyphDoubleClicked: (index, posX, posY)=> {mainWindow.slotInsertRichText(index)};
+ onGlyphClicked: (index, posX, posY)=> {
if (model.childCount > 1){
- charMapAltGlyphs.open()
+ var entryPos = mapToItem(root, 0+width, 0);
+ mainWindow.slotShowPopupPalette(index, entryPos.x, entryPos.y, width, height)
}
}
}
@@ -167,59 +151,6 @@ Rectangle {
ScrollBar.vertical: ScrollBar {
id: charMapScroll;
}
-
- Popup {
- id: charMapAltGlyphs
- x: 0
- y: 0
- width: charMap.width
- height: charMap.cellHeight*3;
- modal: true
- focus: true
- padding: 2;
- closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside
-
- palette: TabBar.palette;
- GridView {
- anchors.fill: parent;
- clip: true;
-
- cellWidth: (width - charMapAltGlyphsScroll.implicitBackgroundWidth)/8;
- cellHeight: cellWidth;
-
- ScrollBar.vertical: ScrollBar {
- id: charMapAltGlyphsScroll;
- }
-
- model: DelegateModel {
- model: charMap.model
- property alias rIndex: charMap.currentIndex;
- property var defaultIndex: modelIndex(-1);
- onRIndexChanged: {
- rootIndex = defaultIndex;
- rootIndex = modelIndex(rIndex);
- }
-
- delegate: GlyphDelegate {
- textColor: sysPalette.text;
- fillColor: sysPalette.base;
- fontFamilies: root.fontFamilies;
- fontSize: root.fontSize;
- fontStyle: root.fontStyle;
- fontWeight: root.fontWeight;
- onGlyphDoubleClicked: (index)=> {
- mainWindow.slotInsertRichText(charMap.currentIndex, index);
- charMapAltGlyphs.close()
- };
- onGlyphClicked: (index)=> {
- mainWindow.slotInsertRichText(charMap.currentIndex, index);
- charMapAltGlyphs.close()
- };
- }
-
- }
- }
- }
}
}
}
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.cpp b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.cpp
new file mode 100644
index 0000000000..9d4bb78202
--- /dev/null
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.cpp
@@ -0,0 +1,99 @@
+/*
+ * SPDX-FileCopyrightText: 2025 Wolthera van Hövell tot Westerflier <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+#include <QHBoxLayout>
+#include <QQmlEngine>
+#include <QQmlContext>
+#include <QQuickItem>
+#include <KoResourcePaths.h>
+#include <klocalizedstring.h>
+#include "GlyphPaletteAltPopup.h"
+
+GlyphPaletteAltPopup::GlyphPaletteAltPopup(QWidget *parent)
+ : QFrame(parent)
+{
+ setWindowFlags(Qt::Popup);
+ setFrameStyle(QFrame::Box | QFrame::Plain);
+ m_quickWidget = new QQuickWidget(this);
+ QHBoxLayout *layout = new QHBoxLayout(this);
+
+ m_quickWidget->setFixedSize(300, 400);
+
+ layout->addWidget(m_quickWidget);
+ layout->setContentsMargins(0, 0, 0, 0);
+
+ setSizePolicy(QSizePolicy::Policy::Fixed, QSizePolicy::Policy::Fixed);
+ layout->setSizeConstraint(QLayout::SizeConstraint::SetFixedSize);
+
+ m_quickWidget->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
+ m_quickWidget->engine()->rootContext()->setContextProperty("mainWindow", this);
+ m_quickWidget->engine()->rootContext()->setContextObject(new KLocalizedContext(this));
+
+ m_quickWidget->engine()->addImportPath(KoResourcePaths::getApplicationRoot() + "/lib/qml/");
+ m_quickWidget->engine()->addImportPath(KoResourcePaths::getApplicationRoot() + "/lib64/qml/");
+
+ m_quickWidget->engine()->addPluginPath(KoResourcePaths::getApplicationRoot() + "/lib/qml/");
+ m_quickWidget->engine()->addPluginPath(KoResourcePaths::getApplicationRoot() + "/lib64/qml/");
+
+ m_quickWidget->setPalette(this->palette());
+
+ m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
+ m_quickWidget->setSource(QUrl("qrc:/GlyphPaletteAlts.qml"));
+ if (!m_quickWidget->errors().empty()) {
+ qWarning() << "Errors in " << windowTitle() << ":" << m_quickWidget->errors();
+ } else if (m_quickWidget->rootObject()){
+ m_quickWidget->rootObject()->setProperty("columns", QVariant::fromValue(3));
+ }
+}
+
+GlyphPaletteAltPopup::~GlyphPaletteAltPopup()
+{
+ /// Prevent accessing destroyed objects in QML engine
+ /// See:
+ /// * https://invent.kde.org/graphics/krita/-/commit/d8676f4e9cac1a8728e73fec3ff1df1763c713b7
+ /// * https://bugreports.qt.io/browse/QTBUG-81247
+ m_quickWidget->setParent(nullptr);
+ delete m_quickWidget;
+}
+
+void GlyphPaletteAltPopup::setRootIndex(const int index)
+{
+ if (m_charMapModel) {
+ QModelIndex idx = m_charMapModel->index(index, 0);
+ if (idx.isValid()) {
+ m_quickWidget->rootObject()->setProperty("parentIndex", QVariant::fromValue(index));
+ }
+ }
+}
+
+void GlyphPaletteAltPopup::setCellSize(const int width, const int height)
+{
+ m_quickWidget->setFixedSize(width*3, height*4);
+}
+
+void GlyphPaletteAltPopup::setModel(QAbstractItemModel *model)
+{
+ m_charMapModel = model;
+ if (m_quickWidget->rootObject() && m_charMapModel) {
+ m_quickWidget->rootObject()->setProperty("glyphModel", QVariant::fromValue(m_charMapModel));
+ }
+}
+
+void GlyphPaletteAltPopup::setMarkup(const QStringList &families, const int size, const int weight, const int width, const QFont::Style style)
+{
+ if (m_quickWidget->rootObject()) {
+ m_quickWidget->rootObject()->setProperty("fontFamilies", QVariant::fromValue(families));
+ m_quickWidget->rootObject()->setProperty("fontSize", QVariant::fromValue(size));
+ m_quickWidget->rootObject()->setProperty("fontWeight", QVariant::fromValue(weight));
+ m_quickWidget->rootObject()->setProperty("fontWidth", QVariant::fromValue(width));
+ m_quickWidget->rootObject()->setProperty("fontStyle", QVariant::fromValue(style));
+ }
+}
+
+void GlyphPaletteAltPopup::slotInsertRichText(const int charRow, const int glyphRow, const bool replace)
+{
+ emit sigInsertRichText(charRow, glyphRow, replace);
+}
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.h b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.h
new file mode 100644
index 0000000000..31bd72f6d0
--- /dev/null
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAltPopup.h
@@ -0,0 +1,61 @@
+/*
+ * SPDX-FileCopyrightText: 2025 Wolthera van Hövell tot Westerflier <[email protected]>
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+#ifndef GLYPHPALETTEALTPOPUP_H
+#define GLYPHPALETTEALTPOPUP_H
+
+#include <QFrame>
+#include <QQuickWidget>
+#include <QAbstractItemModel>
+
+/**
+ * @brief The GlyphPaletteAltPopup class
+ *
+ * Because QtQuickWidgets don't allow pop-ups to be drawn outside of their geometry,
+ * we use this frame as a workaround, to allow the glyph-alts in the character map
+ * to overlap the rest of the window.
+ */
+class GlyphPaletteAltPopup : public QFrame
+{
+ Q_OBJECT
+public:
+ GlyphPaletteAltPopup(QWidget *parent = nullptr);
+ ~GlyphPaletteAltPopup();
+
+ /**
+ * @brief setRootIndex
+ * Set the charmap root index to show glyph alts for.
+ */
+ void setRootIndex(const int index);
+ /**
+ * @brief setCellSize
+ * Set the size of the pop-up relative to its cellsize.
+ * The popup is 3 cells wide and 4 high, allowing for 12
+ * alternates to be visible at once.
+ */
+ void setCellSize(const int width, const int height);
+ /**
+ * @brief setModel
+ * Set the glyph proxy model.
+ */
+ void setModel(QAbstractItemModel *model);
+
+ /**
+ * @brief setMarkup
+ * Set the css font markup to be used inside the palette.
+ */
+ void setMarkup(const QStringList &families, const int size, const int weight, const int width, const QFont::Style style);
+
+public Q_SLOTS:
+
+ void slotInsertRichText(const int charRow, const int glyphRow = -1, const bool replace = false);
+Q_SIGNALS:
+ void sigInsertRichText(int charRow, int glyphRow, bool replace);
+private:
+ QQuickWidget *m_quickWidget {0};
+ QAbstractItemModel *m_charMapModel {0};
+};
+
+#endif // GLYPHPALETTEALTPOPUP_H
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAlts.qml b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAlts.qml
new file mode 100644
index 0000000000..7b35671ffc
--- /dev/null
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteAlts.qml
@@ -0,0 +1,65 @@
+import QtQuick 2.15
+import QtQuick.Controls 2.5
+import QtQml.Models 2.15
+import org.krita.tools.text 1.0
+
+Rectangle {
+ id: root;
+ property QtObject glyphModel;
+ property int parentIndex: 0;
+ property int columns: 8;
+ property bool replace: false;
+
+ property var fontFamilies: [];
+ property double fontSize: 10.0;
+ property double fontWeight: 400;
+ property double fontWidth: 100;
+ property int fontStyle: 0;
+ property double fontSlant: 0.0;
+ SystemPalette {
+ id: sysPalette;
+ colorGroup: SystemPalette.Active
+ }
+
+ color: sysPalette.base;
+
+ GridView {
+ anchors.fill: parent;
+
+ 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 = modelIndex(root.parentIndex);
+ }
+
+ delegate: GlyphDelegate {
+ textColor: hovered? sysPalette.highlightedText: sysPalette.text;
+ fillColor: hovered? sysPalette.highlight: sysPalette.base;
+ fontFamilies: root.fontFamilies;
+ fontSize: root.fontSize;
+ fontStyle: root.fontStyle;
+ fontWeight: root.fontWeight;
+ onGlyphClicked: (index, posX, posY)=> {
+ if (!root.replace) {
+ mainWindow.slotInsertRichText(root.parentIndex, index, root.replace)
+ }
+ };
+ onGlyphDoubleClicked: (index, posX, posY)=> {mainWindow.slotInsertRichText(root.parentIndex, index, root.replace)};
+ }
+ }
+ focus: true;
+ clip: true;
+
+ cellWidth: width/root.columns;
+ cellHeight: cellWidth;
+
+ ScrollBar.vertical: ScrollBar {
+ id: glyphAltScroll;
+ }
+ }
+}
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp
index 87870d8f60..3279530773 100644
--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.cpp
@@ -19,6 +19,7 @@
GlyphPaletteDialog::GlyphPaletteDialog(QWidget *parent)
: KoDialog(parent)
+ , m_altPopup(new GlyphPaletteAltPopup(this))
, m_model(new KoFontGlyphModel(this))
, m_charMapModel(new GlyphPaletteProxyModel(this))
{
@@ -46,6 +47,7 @@ GlyphPaletteDialog::GlyphPaletteDialog(QWidget *parent)
this->setWindowTitle(i18nc("@title:window", "Glyph Palette"));
m_charMapModel->setSourceModel(m_model);
+ m_altPopup->setModel(m_charMapModel);
connect(m_model, SIGNAL(modelReset()), m_charMapModel, SLOT(emitBlockLabelsChanged()));
m_quickWidget->rootContext()->setContextProperty("glyphModel", QVariant::fromValue(m_model));
@@ -56,6 +58,19 @@ 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)));
+}
+
+GlyphPaletteDialog::~GlyphPaletteDialog()
+{
+
+ /// Prevent accessing destroyed objects in QML engine
+ /// See:
+ /// * https://invent.kde.org/graphics/krita/-/commit/d8676f4e9cac1a8728e73fec3ff1df1763c713b7
+ /// * https://bugreports.qt.io/browse/QTBUG-81247
+ m_quickWidget->setParent(nullptr);
+ delete m_quickWidget;
+
}
void GlyphPaletteDialog::setGlyphModelFromProperties(const QPair<KoSvgTextProperties, KoSvgTextProperties> &properties, const QString &text)
@@ -81,7 +96,8 @@ void GlyphPaletteDialog::setGlyphModelFromProperties(const QPair<KoSvgTextProper
}
QStringList families = properties.second.property(KoSvgTextProperties::FontFamiliesId).toStringList();
qreal size = properties.second.propertyOrDefault(KoSvgTextProperties::FontSizeId).toReal();
- int weight = properties.second.propertyOrDefault(KoSvgTextProperties::FontWeightId).toInt();
+ const int weight = properties.second.propertyOrDefault(KoSvgTextProperties::FontWeightId).toInt();
+ const int width = properties.second.propertyOrDefault(KoSvgTextProperties::FontStretchId).toInt();
const std::vector<FT_FaceSP> faces = KoFontRegistry::instance()->facesForCSSValues(
properties.second.property(KoSvgTextProperties::FontFamiliesId).toStringList(),
lengths,
@@ -91,8 +107,8 @@ void GlyphPaletteDialog::setGlyphModelFromProperties(const QPair<KoSvgTextProper
static_cast<quint32>(res),
size,
fontSizeAdjust.isAuto ? 1.0 : fontSizeAdjust.customValue,
- properties.second.propertyOrDefault(KoSvgTextProperties::FontWeightId).toInt(),
- properties.second.propertyOrDefault(KoSvgTextProperties::FontStretchId).toInt(),
+ width,
+ weight,
style.style,
style.slantValue.isAuto? 14: style.slantValue.customValue);
@@ -104,15 +120,19 @@ void GlyphPaletteDialog::setGlyphModelFromProperties(const QPair<KoSvgTextProper
m_quickWidget->rootObject()->setProperty("fontFamilies", QVariant::fromValue(families));
m_quickWidget->rootObject()->setProperty("fontSize", QVariant::fromValue(size));
m_quickWidget->rootObject()->setProperty("fontWeight", QVariant::fromValue(weight));
- m_quickWidget->rootObject()->setProperty("fontStyle", QVariant::fromValue(style));
+ m_quickWidget->rootObject()->setProperty("fontWidth", QVariant::fromValue(width));
+ m_quickWidget->rootObject()->setProperty("fontStyle", QVariant::fromValue(style.style));
if (idx.isValid()) {
m_quickWidget->rootObject()->setProperty("currentIndex", QVariant::fromValue(idx.row()));
}
}
+ if (m_altPopup) {
+ m_altPopup->setMarkup(families, size, weight, width, style.style);
+ }
m_lastUsedProperties = properties.first;
}
-void GlyphPaletteDialog::slotInsertRichText(int charRow, int glyphRow, bool replace)
+void GlyphPaletteDialog::slotInsertRichText(const int charRow, const int glyphRow, const bool replace)
{
if (m_quickWidget->rootObject()) {
QModelIndex idx = replace? m_model->index(charRow, 0): m_charMapModel->index(charRow, 0);
@@ -136,6 +156,24 @@ void GlyphPaletteDialog::slotInsertRichText(int charRow, int glyphRow, bool repl
richText->setPropertiesAtPos(-1, props);
richText->insertText(0, text);
emit signalInsertRichText(richText, replace);
+ if (m_altPopup->isVisible()) {
+ slotHidePopupPalette();
+ }
}
}
+
+void GlyphPaletteDialog::slotShowPopupPalette(const int charRow, const int x, const int y, const int cellWidth, const int cellHeight)
+{
+ m_altPopup->setRootIndex(charRow);
+ m_altPopup->setCellSize(cellWidth, cellHeight);
+ m_altPopup->raise();
+ m_altPopup->show();
+ m_altPopup->move(this->mapToGlobal(QPoint(x, y)+m_quickWidget->pos()));
+ m_altPopup->activateWindow();
+}
+
+void GlyphPaletteDialog::slotHidePopupPalette()
+{
+ m_altPopup->hide();
+}
diff --git a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.h b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.h
index 3b42177bbd..1652c0020b 100644
--- a/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.h
+++ b/plugins/tools/svgtexttool/glyphpalette/GlyphPaletteDialog.h
@@ -15,12 +15,14 @@
#include <QStandardItemModel>
#include "GlyphPaletteProxyModel.h"
+#include "GlyphPaletteAltPopup.h"
class GlyphPaletteDialog: public KoDialog
{
Q_OBJECT
public:
GlyphPaletteDialog(QWidget *parent = nullptr);
+ ~GlyphPaletteDialog();
void setGlyphModelFromProperties(const QPair<KoSvgTextProperties, KoSvgTextProperties> &properties, const QString &text);
@@ -28,9 +30,14 @@ Q_SIGNALS:
void signalInsertRichText(KoSvgTextShape *text, bool replace);
public Q_SLOTS:
- void slotInsertRichText(int charRow, int glyphRow = -1, bool replace = false);
+ void slotInsertRichText(const int charRow, const int glyphRow = -1, const bool replace = 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();
+
private:
QQuickWidget *m_quickWidget {0};
+ GlyphPaletteAltPopup *m_altPopup {0};
KoSvgTextProperties m_lastUsedProperties;
KoFontGlyphModel *m_model;
GlyphPaletteProxyModel *m_charMapModel;
diff --git a/plugins/tools/svgtexttool/svgtexttool.qrc b/plugins/tools/svgtexttool/svgtexttool.qrc
index a843191e39..41fb925849 100644
--- a/plugins/tools/svgtexttool/svgtexttool.qrc
+++ b/plugins/tools/svgtexttool/svgtexttool.qrc
@@ -13,5 +13,6 @@
<file>tool_text_i_beam_horizontal_done.xpm</file>
<file alias="GlyphPalette.qml">glyphpalette/GlyphPalette.qml</file>
<file alias="GlyphDelegate.qml">glyphpalette/GlyphDelegate.qml</file>
+ <file alias="GlyphPaletteAlts.qml">glyphpalette/GlyphPaletteAlts.qml</file>
</qresource>
</RCC>