Commit 22ace5fc authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Disable links to QML errors when compiling against Qt 4.6

This feature depends on the availability of QPlainTextEdit::anchorAt.
parent c46f9773
...@@ -460,6 +460,8 @@ void OutputWindow::appendOutputInline(const QString &out) ...@@ -460,6 +460,8 @@ void OutputWindow::appendOutputInline(const QString &out)
format.setForeground(palette().text().color()); format.setForeground(palette().text().color());
setCurrentCharFormat(format); setCurrentCharFormat(format);
// (This feature depends on the availability of QPlainTextEdit::anchorAt)
#if QT_VERSION >= 0x040700
// Convert to HTML, preserving newlines and whitespace // Convert to HTML, preserving newlines and whitespace
s = Qt::convertFromPlainText(s); s = Qt::convertFromPlainText(s);
...@@ -472,6 +474,9 @@ void OutputWindow::appendOutputInline(const QString &out) ...@@ -472,6 +474,9 @@ void OutputWindow::appendOutputInline(const QString &out)
index += link.length(); index += link.length();
} }
appendHtml(s); appendHtml(s);
#else
appendPlainText(s);
#endif
} }
enableUndoRedo(); enableUndoRedo();
...@@ -531,6 +536,7 @@ void OutputWindow::mouseReleaseEvent(QMouseEvent *e) ...@@ -531,6 +536,7 @@ void OutputWindow::mouseReleaseEvent(QMouseEvent *e)
return; return;
} }
#if QT_VERSION >= 0x040700
const QString href = anchorAt(e->pos()); const QString href = anchorAt(e->pos());
if (!href.isEmpty()) { if (!href.isEmpty()) {
QRegExp qmlErrorLink(QLatin1String("^file://(/[^:]+):(\\d+):(\\d+)")); QRegExp qmlErrorLink(QLatin1String("^file://(/[^:]+):(\\d+):(\\d+)"));
...@@ -542,12 +548,14 @@ void OutputWindow::mouseReleaseEvent(QMouseEvent *e) ...@@ -542,12 +548,14 @@ void OutputWindow::mouseReleaseEvent(QMouseEvent *e)
TextEditor::BaseTextEditor::openEditorAt(fileName, line, column - 1); TextEditor::BaseTextEditor::openEditorAt(fileName, line, column - 1);
} }
} }
#endif
} }
void OutputWindow::mouseMoveEvent(QMouseEvent *e) void OutputWindow::mouseMoveEvent(QMouseEvent *e)
{ {
QPlainTextEdit::mouseMoveEvent(e); QPlainTextEdit::mouseMoveEvent(e);
#if QT_VERSION >= 0x040700
// Cursor was dragged to make a selection, deactivate links // Cursor was dragged to make a selection, deactivate links
if (m_mousePressed && textCursor().hasSelection()) if (m_mousePressed && textCursor().hasSelection())
m_linksActive = false; m_linksActive = false;
...@@ -556,4 +564,5 @@ void OutputWindow::mouseMoveEvent(QMouseEvent *e) ...@@ -556,4 +564,5 @@ void OutputWindow::mouseMoveEvent(QMouseEvent *e)
viewport()->setCursor(Qt::IBeamCursor); viewport()->setCursor(Qt::IBeamCursor);
else else
viewport()->setCursor(Qt::PointingHandCursor); viewport()->setCursor(Qt::PointingHandCursor);
#endif
} }
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment