Changeset View
Changeset View
Standalone View
Standalone View
ui/annotwindow.cpp
Show First 20 Lines • Show All 192 Lines • ▼ Show 20 Line(s) | |||||
193 | 193 | | |||
194 | // Qt::SubWindow is needed to make QSizeGrip work | 194 | // Qt::SubWindow is needed to make QSizeGrip work | ||
195 | AnnotWindow::AnnotWindow( QWidget * parent, Okular::Annotation * annot, Okular::Document *document, int page ) | 195 | AnnotWindow::AnnotWindow( QWidget * parent, Okular::Annotation * annot, Okular::Document *document, int page ) | ||
196 | : QFrame( parent, Qt::SubWindow ), m_annot( annot ), m_document( document ), m_page( page ) | 196 | : QFrame( parent, Qt::SubWindow ), m_annot( annot ), m_document( document ), m_page( page ) | ||
197 | { | 197 | { | ||
198 | setAutoFillBackground( true ); | 198 | setAutoFillBackground( true ); | ||
199 | setFrameStyle( Panel | Raised ); | 199 | setFrameStyle( Panel | Raised ); | ||
200 | setAttribute( Qt::WA_DeleteOnClose ); | 200 | setAttribute( Qt::WA_DeleteOnClose ); | ||
201 | setObjectName("AnnotWindow"); | 201 | setObjectName(QStringLiteral("AnnotWindow")); | ||
202 | 202 | | |||
203 | const bool canEditAnnotation = m_document->canModifyPageAnnotation( annot ); | 203 | const bool canEditAnnotation = m_document->canModifyPageAnnotation( annot ); | ||
204 | 204 | | |||
205 | textEdit = new KTextEdit( this ); | 205 | textEdit = new KTextEdit( this ); | ||
206 | textEdit->setAcceptRichText( false ); | 206 | textEdit->setAcceptRichText( false ); | ||
207 | textEdit->setPlainText( m_annot->contents() ); | 207 | textEdit->setPlainText( m_annot->contents() ); | ||
208 | textEdit->installEventFilter( this ); | 208 | textEdit->installEventFilter( this ); | ||
209 | textEdit->setUndoRedoEnabled( false ); | 209 | textEdit->setUndoRedoEnabled( false ); | ||
▲ Show 20 Lines • Show All 206 Lines • ▼ Show 20 Line(s) | 415 | { | |||
416 | textEdit->setAcceptRichText( false ); | 416 | textEdit->setAcceptRichText( false ); | ||
417 | textEdit->setPlainText( m_annot->contents() ); | 417 | textEdit->setPlainText( m_annot->contents() ); | ||
418 | connect(textEdit, &KTextEdit::textChanged, this, &AnnotWindow::slotsaveWindowText); | 418 | connect(textEdit, &KTextEdit::textChanged, this, &AnnotWindow::slotsaveWindowText); | ||
419 | connect(textEdit, &KTextEdit::cursorPositionChanged, this, &AnnotWindow::slotsaveWindowText); | 419 | connect(textEdit, &KTextEdit::cursorPositionChanged, this, &AnnotWindow::slotsaveWindowText); | ||
420 | textEdit->setReadOnly( false ); | 420 | textEdit->setReadOnly( false ); | ||
421 | } | 421 | } | ||
422 | } | 422 | } | ||
423 | 423 | | |||
424 | void AnnotWindow::slotHandleContentsChangedByUndoRedo(Okular::Annotation* annot, QString contents, int cursorPos, int anchorPos) | 424 | void AnnotWindow::slotHandleContentsChangedByUndoRedo(Okular::Annotation* annot, const QString &contents, int cursorPos, int anchorPos) | ||
425 | { | 425 | { | ||
426 | if ( annot != m_annot ) | 426 | if ( annot != m_annot ) | ||
427 | { | 427 | { | ||
428 | return; | 428 | return; | ||
429 | } | 429 | } | ||
430 | 430 | | |||
431 | textEdit->setPlainText(contents); | 431 | textEdit->setPlainText(contents); | ||
432 | QTextCursor c = textEdit->textCursor(); | 432 | QTextCursor c = textEdit->textCursor(); | ||
Show All 10 Lines |