fix for broken CMakeOutputWidget (2.1.2cvs)

Kuba Ober kuba at
Wed Jun 12 16:10:04 UTC 2002

On wtorek 11 czerwiec 2002 07:48 pm, falk.brettschneider at wrote:
> Hi!
> A patch is attached fixing three newly broken issues with the output
> tool-view happened with my Qt-3.0.3. I've got SuSE-8.0 (Qt-3.0.3,
> KDE-3.0.0), so please also test it with newer Qt/KDE versions! I tested
> it with KDE-2 and it works well there, too. I already committed because
> of the running timeout until the KDE-3.0.2 release.

Did anybody try it making the output widget a plain text widget? I believe 
this works just fine in QT3.0.4 and requires only minor changes to the source 
(patch is on the list since a week and a half, or so). The recent additions 
to the outputwidget that I have seen are pretty hackish and it works all 
right for me here, on QT3.0.3 and QT3.0.4, so I wonder why all the mess? As 
far as I can tell, QTextEdit is severely broken wrt to rich text formatting 
(especially about missing the <br> tags, etc), and changing it to plain text 
has fixed all the brokenness for me. It's a change that requires adding 7 
lines of code, changing 2, adding one class member (QColor), and removing 3 
now-redundant lines of code. I have reincluded it below so that you don't 
have to look for it on the list.

It applies to kdevelop-2.1 as released with kde 3.0.1, and it's meant to 
replace many coutputwidget patches that were posted after I posted that 

I'd be more than glad if somebody with cvs access could make a compile without 
all the recent outputwidget patches related to formatting, etc. and see if my 
approach works.

If anybody asks why did I have to fix it in the first place, here it goes: 
under QT3.0.4, gcc 3.1, the rich text widget refuses to recognize <br> tags, 
so all output lines are concatenated together. Making it plain text widget 
gets rid of all possible escaping problems that had to be patched separately, 
and gets rid of this line-breaking thingo as well.

As far as some img-bulleting advocates are concerned: folks, let's realize 
that this stuff has to go with now-being-closed kdevelop 2.1. I'm sure gideon 
will require qt 3.0.5 or better, and then we don't need any stupid 
workarounds neither for qt 2.x nor qt<=3.0.4, and we can add visual candy to 
everybody's liking. This was about making the least possible changeset to 
kdevelop 2.1 sources while still keeping it working with qt 2.x and  qt 
3.0.3/3.0.4. I believe my patches are the smallest possible which work, fix 
*two* problems (line breaks + escaping), and don't seem to introduce any 
other problems nor need for changes elsewhere in the code.

Cheers, Kuba Ober

--- kdevelop-2.1-org/kdevelop/coutputwidget.h	Sun Mar 24 21:22:39 2002
+++ kdevelop-2.1/kdevelop/coutputwidget.h	Wed May 29 11:36:19 2002
@@ -95,6 +95,7 @@
   int mapToView( int xIndex, int line );

+  QColor m_defColor;
   QString m_buf;
   QStack<QString> m_dirStack;
   KRegExp m_enterDir;
--- kdevelop-2.1-org/kdevelop/coutputwidget.cpp	Sun Mar 24 21:22:39 2002
+++ kdevelop-2.1/kdevelop/coutputwidget.cpp	Wed Jun  5 10:59:20 2002
@@ -28,6 +28,9 @@
 //  KEdit(parent,name)
   QMultiLineEdit(parent, name)
+#if QT_VERSION >= 300
+  setTextFormat(Qt::PlainText);

 void COutputWidget::insertAtEnd(const QString& s)
@@ -82,7 +85,8 @@
   setWordWrap(WidgetWidth); // -JROC
   setWrapPolicy(Anywhere); // -JROC
 #if QT_VERSION >= 300
-  setTextFormat(Qt::RichText);
+  setTextFormat(Qt::PlainText);
+  m_defColor = color();

@@ -121,15 +125,17 @@
     switch (lineType(paraCount))
       case Error:
-        line = "<font color=\"darkRed\">" + line + "</font><br>";
+        setColor(Qt::darkRed);
+        setColor(m_defColor);
       case Diagnostic:
-        line = "<font color=\"darkBlue\">" + line + "</font><br>";
+        setColor(Qt::darkBlue);
+        setColor(m_defColor);
-        append(line + "<br>");
+        append(line);

@@ -149,6 +155,9 @@
+#if QT_VERSION >= 300
+  setColor(m_defColor);

   // dummy needed ?
   ErrorDetails errorDetails("", -1, Normal);

More information about the KDevelop-devel mailing list