Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

Commit 93121820 authored by Albert Astals Cid's avatar Albert Astals Cid

Fix latex render in annotations

We need
  disconnect(textEdit, SIGNAL(cursorPositionChanged()), this,SLOT(slotsaveWindowText()));
and it's counterpart, otherwise when inserting the image, the cursor pos changes, slotsaveWindowText is called, the content is passed by a toPlainText and set again and kaboom the content is lost

Also a few extra const

BUGS: 335476
FIXED-IN: 4.14.2
parent 5e2d190e
......@@ -327,8 +327,8 @@ void AnnotWindow::slotOptionBtn()
void AnnotWindow::slotsaveWindowText()
QString contents = textEdit->toPlainText();
int cursorPos = textEdit->textCursor().position();
const QString contents = textEdit->toPlainText();
const int cursorPos = textEdit->textCursor().position();
if (contents != m_annot->contents())
m_document->editPageAnnotationContents( m_page, m_annot, contents, cursorPos, m_prevCursorPos, m_prevAnchorPos);
......@@ -344,6 +344,7 @@ void AnnotWindow::renderLatex( bool render )
textEdit->setReadOnly( true );
disconnect(textEdit, SIGNAL(textChanged()), this,SLOT(slotsaveWindowText()));
disconnect(textEdit, SIGNAL(cursorPositionChanged()), this,SLOT(slotsaveWindowText()));
textEdit->setAcceptRichText( true );
QString contents = m_annot->contents();
contents = Qt::convertFromPlainText( contents );
......@@ -384,6 +385,7 @@ void AnnotWindow::renderLatex( bool render )
textEdit->setAcceptRichText( false );
textEdit->setPlainText( m_annot->contents() );
connect(textEdit, SIGNAL(textChanged()), this,SLOT(slotsaveWindowText()));
connect(textEdit, SIGNAL(cursorPositionChanged()), this,SLOT(slotsaveWindowText()));
textEdit->setReadOnly( false );
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment