[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [calligra] libs/kotext: Fix applying of paragraphStyle, apply also the characterStyle on the caret.
From: Pierre Stirnweiss <pstirnweiss () googlemail ! com>
Date: 2012-12-07 10:50:06
Message-ID: 20121207105006.F0D99A60C4 () git ! kde ! org
[Download RAW message or body]
Git commit 48ac9482b8a1b36016c35096e5fabab433419458 by Pierre Stirnweiss.
Committed on 06/12/2012 at 19:32.
Pushed by pstirnweiss into branch 'master'.
Fix applying of paragraphStyle, apply also the characterStyle on the caret.
On applying a paragraphStyle, the block was applied the paragraph and character styles.
However, the KoTextEditor caret wasn't applied the characterStyle.
M +10 -0 libs/kotext/KoTextEditor_format.cpp
http://commits.kde.org/calligra/48ac9482b8a1b36016c35096e5fabab433419458
diff --git a/libs/kotext/KoTextEditor_format.cpp b/libs/kotext/KoTextEditor_format.cpp
index dd14862..d1f0694 100644
--- a/libs/kotext/KoTextEditor_format.cpp
+++ b/libs/kotext/KoTextEditor_format.cpp
@@ -481,11 +481,21 @@ void KoTextEditor::setStyle(KoParagraphStyle *style)
{
d->updateState(KoTextEditor::Private::Custom, i18nc("(qtundo-format)", "Set Paragraph Style"));
+ int caretAnchor = d->caret.anchor();
+ int caretPosition = d->caret.position();
KoStyleManager *styleManager = KoTextDocument(d->document).styleManager();
SetParagraphStyleVisitor visitor(this, styleManager, style);
recursivelyVisitSelection(d->document->rootFrame()->begin(), visitor);
+ if (!isEditProtected() && caretAnchor == caretPosition) {
+ style->KoCharacterStyle::applyStyle(&(d->caret));
+ }
+ else {
+ d->caret.setPosition(caretAnchor);
+ d->caret.setPosition(caretPosition, QTextCursor::KeepAnchor);
+ }
+
d->updateState(KoTextEditor::Private::NoOp);
emit paragraphStyleApplied(style);
emit textFormatChanged();
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic