diff options
Diffstat (limited to 'tools/linguist')
-rw-r--r-- | tools/linguist/linguist/messageeditor.cpp | 7 | ||||
-rw-r--r-- | tools/linguist/linguist/messageeditor.h | 1 | ||||
-rw-r--r-- | tools/linguist/linguist/messageeditorwidgets.cpp | 4 | ||||
-rw-r--r-- | tools/linguist/linguist/messageeditorwidgets.h | 1 |
4 files changed, 12 insertions, 1 deletions
diff --git a/tools/linguist/linguist/messageeditor.cpp b/tools/linguist/linguist/messageeditor.cpp index 6cafe8e..87c2f4a 100644 --- a/tools/linguist/linguist/messageeditor.cpp +++ b/tools/linguist/linguist/messageeditor.cpp @@ -262,6 +262,7 @@ void MessageEditor::addPluralForm(int model, const QString &label, bool writable { FormMultiWidget *transEditor = new FormMultiWidget(label); connect(transEditor, SIGNAL(editorCreated(QTextEdit*)), SLOT(editorCreated(QTextEdit*))); + connect(transEditor, SIGNAL(editorDeleted(QTextEdit*)), SLOT(editorDeleted(QTextEdit*))); transEditor->setEditingEnabled(writable); transEditor->setHideWhenEmpty(!writable); if (!m_editors[model].transTexts.isEmpty()) @@ -298,6 +299,12 @@ void MessageEditor::editorCreated(QTextEdit *te) } } +void MessageEditor::editorDeleted(QTextEdit *te) +{ + if (m_selectionHolder == te) + resetSelection(); +} + void MessageEditor::fixTabOrder() { m_tabOrderTimer.start(0); diff --git a/tools/linguist/linguist/messageeditor.h b/tools/linguist/linguist/messageeditor.h index 4686d3d..21b3405 100644 --- a/tools/linguist/linguist/messageeditor.h +++ b/tools/linguist/linguist/messageeditor.h @@ -114,6 +114,7 @@ public slots: private slots: void editorCreated(QTextEdit *); + void editorDeleted(QTextEdit *); void selectionChanged(QTextEdit *); void resetHoverSelection(); void emitTranslationChanged(QTextEdit *); diff --git a/tools/linguist/linguist/messageeditorwidgets.cpp b/tools/linguist/linguist/messageeditorwidgets.cpp index 6422b47..29df673 100644 --- a/tools/linguist/linguist/messageeditorwidgets.cpp +++ b/tools/linguist/linguist/messageeditorwidgets.cpp @@ -362,9 +362,11 @@ void FormMultiWidget::setTranslation(const QString &text, bool userAction) QStringList texts = text.split(QChar(Translator::BinaryVariantSeparator), QString::KeepEmptyParts); while (m_editors.count() > texts.count()) { + FormatTextEdit *editor = m_editors.takeLast(); + emit editorDeleted(editor); delete m_minusButtons.takeLast(); delete m_plusButtons.takeLast(); - delete m_editors.takeLast(); + delete editor; } while (m_editors.count() < texts.count()) addEditor(m_editors.count()); diff --git a/tools/linguist/linguist/messageeditorwidgets.h b/tools/linguist/linguist/messageeditorwidgets.h index cb24377..1f6f1f5 100644 --- a/tools/linguist/linguist/messageeditorwidgets.h +++ b/tools/linguist/linguist/messageeditorwidgets.h @@ -150,6 +150,7 @@ public: signals: void editorCreated(QTextEdit *); + void editorDeleted(QTextEdit *); void textChanged(QTextEdit *); void selectionChanged(QTextEdit *); void cursorPositionChanged(); |