From 22ace5fcafc62f2e4edafd969e8d5074fcd9005f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Thorbj=C3=B8rn=20Lindeijer?= <thorbjorn.lindeijer@nokia.com>
Date: Mon, 22 Feb 2010 11:57:28 +0100
Subject: [PATCH] Disable links to QML errors when compiling against Qt 4.6

This feature depends on the availability of QPlainTextEdit::anchorAt.
---
 src/plugins/projectexplorer/outputwindow.cpp | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/src/plugins/projectexplorer/outputwindow.cpp b/src/plugins/projectexplorer/outputwindow.cpp
index b9913f3ec93..e3575fdeed7 100644
--- a/src/plugins/projectexplorer/outputwindow.cpp
+++ b/src/plugins/projectexplorer/outputwindow.cpp
@@ -460,6 +460,8 @@ void OutputWindow::appendOutputInline(const QString &out)
         format.setForeground(palette().text().color());
         setCurrentCharFormat(format);
 
+        // (This feature depends on the availability of QPlainTextEdit::anchorAt)
+#if QT_VERSION >= 0x040700
         // Convert to HTML, preserving newlines and whitespace
         s = Qt::convertFromPlainText(s);
 
@@ -472,6 +474,9 @@ void OutputWindow::appendOutputInline(const QString &out)
             index += link.length();
         }
         appendHtml(s);
+#else
+        appendPlainText(s);
+#endif
     }
 
     enableUndoRedo();
@@ -531,6 +536,7 @@ void OutputWindow::mouseReleaseEvent(QMouseEvent *e)
         return;
     }
 
+#if QT_VERSION >= 0x040700
     const QString href = anchorAt(e->pos());
     if (!href.isEmpty()) {
         QRegExp qmlErrorLink(QLatin1String("^file://(/[^:]+):(\\d+):(\\d+)"));
@@ -542,12 +548,14 @@ void OutputWindow::mouseReleaseEvent(QMouseEvent *e)
             TextEditor::BaseTextEditor::openEditorAt(fileName, line, column - 1);
         }
     }
+#endif
 }
 
 void OutputWindow::mouseMoveEvent(QMouseEvent *e)
 {
     QPlainTextEdit::mouseMoveEvent(e);
 
+#if QT_VERSION >= 0x040700
     // Cursor was dragged to make a selection, deactivate links
     if (m_mousePressed && textCursor().hasSelection())
         m_linksActive = false;
@@ -556,4 +564,5 @@ void OutputWindow::mouseMoveEvent(QMouseEvent *e)
         viewport()->setCursor(Qt::IBeamCursor);
     else
         viewport()->setCursor(Qt::PointingHandCursor);
+#endif
 }
-- 
GitLab