diff --git a/src/widgets/krichtextedit.cpp b/src/widgets/krichtextedit.cpp --- a/src/widgets/krichtextedit.cpp +++ b/src/widgets/krichtextedit.cpp @@ -530,7 +530,6 @@ void KRichTextEdit::keyPressEvent(QKeyEvent *event) { bool handled = false; - textCursor().beginEditBlock(); if (textCursor().currentList()) { // handled is False if the key press event was not handled or not completely // handled by the Helper class. @@ -557,7 +556,6 @@ if (textCursor().currentList()) { d->nestedListHelper->handleAfterKeyPressEvent(event); } - textCursor().endEditBlock(); emit cursorPositionChanged(); } diff --git a/src/widgets/nestedlisthelper.cpp b/src/widgets/nestedlisthelper.cpp --- a/src/widgets/nestedlisthelper.cpp +++ b/src/widgets/nestedlisthelper.cpp @@ -125,7 +125,6 @@ // No need to reformatList in this case. reformatList is slow. if ((event->key() == Qt::Key_Return) || (event->key() == Qt::Key_Backspace)) { - reformatBoundingItemSpacing(); handled = true; } } else { @@ -163,7 +162,6 @@ // list.add( droppedBlock ); } - reformatBoundingItemSpacing(); return true; } @@ -272,8 +270,6 @@ cursor.createList(listFmt); reformatList(); } - - reformatBoundingItemSpacing(); } void NestedListHelper::handleOnIndentLess() @@ -295,7 +291,6 @@ cursor.setBlockFormat(bfmt); reformatList(cursor.block().next()); } - reformatBoundingItemSpacing(); } void NestedListHelper::handleOnBulletType(int styleIndex) @@ -322,73 +317,7 @@ QTextBlockFormat bfmt; bfmt.setObjectIndex(-1); cursor.setBlockFormat(bfmt); - reformatBoundingItemSpacing(); } - reformatBoundingItemSpacing(); reformatList(); } - -void NestedListHelper::reformatBoundingItemSpacing(QTextBlock block) -{ - // This is a workaround for qt bug 201228. Spacing between items is not kept - // consistent. - // Fixed scheduled for qt4.5 - // -- Stephen Kelly, 8th June 2008 - - int nextBlockTopMargin = listNoMargin; - int previousBlockBottomMargin = listNoMargin; - int thisBlockBottomMargin = listBottomMargin; - int thisBlockTopMargin = listTopMargin; - bool prevBlockValid = block.previous().isValid(); - bool nextBlockValid = block.next().isValid(); - - if (block.textList()) { - if (prevBlockValid && block.previous().textList()) { - thisBlockTopMargin = listNoMargin; - } - - if (nextBlockValid && block.next().textList()) { - thisBlockBottomMargin = listNoMargin; - } - } else { - if (prevBlockValid && !block.previous().textList()) { - thisBlockTopMargin = listNoMargin; - } - if (nextBlockValid && !block.next().textList()) { - thisBlockBottomMargin = listNoMargin; - } - - } - QTextBlockFormat fmt; - QTextCursor cursor; - - fmt = block.blockFormat(); - fmt.setBottomMargin(thisBlockBottomMargin); - fmt.setTopMargin(thisBlockTopMargin); - cursor = QTextCursor(block); - cursor.setBlockFormat(fmt); - - if (nextBlockValid) { - block = block.next(); - fmt = block.blockFormat(); - fmt.setTopMargin(nextBlockTopMargin); - cursor = QTextCursor(block); - cursor.setBlockFormat(fmt); - - block = block.previous(); - } - if (prevBlockValid) { - block = block.previous(); - fmt = block.blockFormat(); - fmt.setBottomMargin(previousBlockBottomMargin); - cursor = QTextCursor(block); - cursor.setBlockFormat(fmt); - } -} - -void NestedListHelper::reformatBoundingItemSpacing() -{ - reformatBoundingItemSpacing(topOfSelection().block()); - reformatBoundingItemSpacing(bottomOfSelection().block()); -} diff --git a/src/widgets/nestedlisthelper_p.h b/src/widgets/nestedlisthelper_p.h --- a/src/widgets/nestedlisthelper_p.h +++ b/src/widgets/nestedlisthelper_p.h @@ -128,8 +128,6 @@ bool canDedent() const; private: - void reformatBoundingItemSpacing(QTextBlock block); - void reformatBoundingItemSpacing(); QTextCursor topOfSelection(); QTextCursor bottomOfSelection(); void processList(QTextList *list);