COutputWidget revisited

F@lk Brettschneider falk.brettschneider at gmx.de
Thu Jun 20 21:54:02 UTC 2002


Hi!

Just my comment from the first sight (without a real test):

Harald Fernengel wrote:

>+#if QT_VERSION >= 300
>+#include <qregexp.h>
>+#endif
>+
>
OK

>+#if QT_VERSION >= 300
>+bool CMakeOutputWidget::isAboveQt303()
>+{
>+  static int result = -1;
>+
>+  if ( result == -1 ) {
>+    int qMajor = -1;
>+    int qMinor = -1;
>+    int qVer = -1;
>+    QRegExp verRegExp("(\\d+)\\.(\\d+)\\.(\\d+)");
>+    verRegExp.search( QString(qVersion()) );
>+    qVer = verRegExp.cap(1).toInt();
>+    qMajor = verRegExp.cap(2).toInt();
>+    qMinor = verRegExp.cap(3).toInt();
>+    //qDebug( "Qt version: %d.%d.%d", qVer, qMajor, qMinor );
>+    if (qVer > 2 && qMajor >= 0 && qMinor > 3) {
>
Hmm.... It seems it will fail for Qt-3.1.0. :-) because of the &&qMinor>3
Better fix it before applying.

>-  styleSheet()->item( "font" )->setDisplayMode( QStyleSheetItem::DisplayBlock );
>+  if ( !isAboveQt303() ) {
>+    styleSheet()->item( "font" )->setDisplayMode( QStyleSheetItem::DisplayBlock );
>+  }
>
What does that styleSheet stuff care for here?

>-    bool isQt304 = false;
>-    if (QString(qVersion()) == "3.0.4") {
>-      isQt304 = true;
>-    }
>-
>
OK

>
>     int paraCount;
>-    if (!isQt304) {
>+    if (isAboveQt303()) {
>
IMO this introduces a new bug again.
The old one is "not qt-3.0.4" which means 3.0.0, 3.0.1, 3.0.3, 3.0.5, ....
Now you say "newer than 3.0.3" which means 3.0.4, 3.0.5, ...

>-        if (line[0]=='\n' && !isQt304) {
>+        if (line[0]=='\n' && !isAboveQt303()) {
>
Hmm....nearly the same new bug as above. I excluded qt-3.0.4, you say 
'all later than 3.0.3' which contains 3.0.4 too.

>-    if (QString(qVersion()) == "3.0.4") {
>+    if (isAboveQt303()) {
>
OK, if the behaviour has been kept since 3.0.4.

>+#else
>+  static bool isAboveQt303();
>
OK

Cheers
F at lk







More information about the KDevelop-devel mailing list