[graphics/krita] plugins/tools/svgtexttool: Fix buttons not working in the svg text editor

Dmitry Kazakov <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 6bde961ba2b651a77f21e9b81483dc019c299de1 by Dmitry Kazakov, on behalf of Luna Lovecraft.
Committed on 27/07/2026 at 12:00.
Pushed by dkazakov into branch 'master'.

Fix buttons not working in the svg text editor

Before this commit buttons in the svg text editor would crash the app,
due to m_currentEditor not being initialized properly, and not handling
tab switching.

BUG:523069

M  +12   -0    plugins/tools/svgtexttool/SvgTextEditor.cpp
M  +1    -0    plugins/tools/svgtexttool/SvgTextEditor.h

https://invent.kde.org/graphics/krita/-/commit/6bde961ba2b651a77f21e9b81483dc019c299de1

diff --git a/plugins/tools/svgtexttool/SvgTextEditor.cpp b/plugins/tools/svgtexttool/SvgTextEditor.cpp
index 145aab7dc4b..b7177937420 100644
--- a/plugins/tools/svgtexttool/SvgTextEditor.cpp
+++ b/plugins/tools/svgtexttool/SvgTextEditor.cpp
@@ -88,6 +88,9 @@ SvgTextEditor::SvgTextEditor(QWidget *parent, Qt::WindowFlags flags)
     connect(m_textEditorWidget.buttons, SIGNAL(rejected()), this, SLOT(slotCloseEditor()));
     connect(m_textEditorWidget.buttons, SIGNAL(clicked(QAbstractButton*)), this, SLOT(dialogButtonClicked(QAbstractButton*)));
 
+    connect(m_textEditorWidget.tabWidget, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
+    tabChanged(m_textEditorWidget.tabWidget->currentIndex());
+
     KConfigGroup cg(KSharedConfig::openConfig(), "SvgTextTool");
     actionCollection()->setConfigGroup("SvgTextTool");
     actionCollection()->setComponentName("svgtexttool");
@@ -485,3 +488,12 @@ bool SvgTextEditor::eventFilter(QObject *const watched, QEvent *const event)
     return false;
     return KXmlGuiWindow::eventFilter(watched, event);
 }
+
+void SvgTextEditor::tabChanged(int index)
+{
+    if (index == 0) {
+        m_currentEditor = m_textEditorWidget.svgTextEdit;
+    } else {
+        m_currentEditor = m_textEditorWidget.svgStylesEdit;
+    }
+}
diff --git a/plugins/tools/svgtexttool/SvgTextEditor.h b/plugins/tools/svgtexttool/SvgTextEditor.h
index 19f843353ba..40889b9d52b 100644
--- a/plugins/tools/svgtexttool/SvgTextEditor.h
+++ b/plugins/tools/svgtexttool/SvgTextEditor.h
@@ -61,6 +61,7 @@ private Q_SLOTS:
     void setModified(bool modified);
     void dialogButtonClicked(QAbstractButton *button);
 
+    void tabChanged(int index);
 Q_SIGNALS:
     void textUpdated(KoSvgTextShape *shape, const QString &svg, const QString &defs);
     void textEditorClosed();
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.