Problems with 3.0.4 qt-copy

Reginald Stadlbauer reggie at trolltech.com
Mon Apr 29 13:04:52 BST 2002


On Monday 29 April 2002 10:58, Stephan Binner wrote:
> Hello,
>
> seems Qt 3.0.4 introduces some new problems for KDE:
>
> - QTextEdit changed, now Cervisia prints all CVS output without line feed.

Unfortunately a fix in the HTML parser of the richtext engine triggered that 
bug, and our testing only covered the non-richtext case of append() (which 
still works fine). Unfortunately we also cannot change the 3.0.4 packages 
anymore (already released to our customers). Following patch fixes the 
problem (and cleans up the code of the append() function as well)

==== //depot/qt/3.0/src/widgets/qtextedit.cpp#91 - 
/home/reggie/troll/qt-3.0/src/widgets/qtextedit.cpp ====
@@ -3647,32 +3647,37 @@
 	else
 	    f = PlainText;
     }
-    if ( f == PlainText ) {
-	QTextCursor oldc( *cursor );
-	ensureFormatted( doc->lastParag() );
-	bool scrollToEnd = contentsY() >= contentsHeight() - visibleHeight() -
-			   ( horizontalScrollBar()->isVisible() ? horizontalScrollBar()->height() 
: 0 );
-	cursor->gotoEnd();
-	if ( cursor->index() > 0 )
-	    cursor->splitAndInsertEmptyParag();
-	QTextCursor oldCursor2 = *cursor;
-  	cursor->insert( text, TRUE );
-	if ( doc->useFormatCollection() && currentFormat != cursor->parag()->at( 
cursor->index() )->format() ) {
+
+    drawCursor( FALSE );
+    QTextCursor oldc( *cursor );
+    ensureFormatted( doc->lastParag() );
+    bool scrollToEnd = contentsY() >= contentsHeight() - visibleHeight() -
+			   ( horizontalScrollBar()->isVisible() ?
+			     horizontalScrollBar()->height() : 0 );
+    cursor->gotoEnd();
+    if ( cursor->index() > 0 )
+	cursor->splitAndInsertEmptyParag();
+    QTextCursor oldCursor2 = *cursor;
+  	
+    if ( f == Qt::PlainText ) {
+	cursor->insert( text, TRUE );
+	if ( doc->useFormatCollection() &&
+	     currentFormat != cursor->parag()->at( cursor->index() )->format() ) {
 	    doc->setSelectionStart( QTextDocument::Temp, &oldCursor2 );
 	    doc->setSelectionEnd( QTextDocument::Temp, cursor );
 	    doc->setFormat( QTextDocument::Temp, currentFormat, QTextFormat::Format 
);
 	    doc->removeSelection( QTextDocument::Temp );
 	}
-	formatMore();
-	repaintChanged();
-	if ( scrollToEnd )
-	    ensureCursorVisible();
-	drawCursor( TRUE );
- 	*cursor = oldc;
-    } else if ( f == RichText ) {
+    } else {
 	doc->setRichTextInternal( text );
-	repaintChanged();
     }
+    formatMore();
+    repaintChanged();
+    if ( scrollToEnd )
+	ensureCursorVisible();
+    *cursor = oldc;
+    if ( !isReadOnly() )
+	cursorVisible = TRUE;
     setModified();
     emit textChanged();
 }

-- 
Reggie (reggie at trolltech.com)





More information about the kde-core-devel mailing list