QmlConsole: Fix bug: Jump to location in editor

Since the file path starts with file:/// use QUrl to
get local file name.

Task-number: QTCREATORBUG-9337
Change-Id: Icf591fdcab8cb626cfbf844c451a2c87c07b853a
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Aurindam Jana
2013-05-24 16:31:01 +02:00
committed by Kai Koehne
parent 25dd94808d
commit b0854e3c71
2 changed files with 14 additions and 2 deletions

View File

@@ -33,6 +33,7 @@
#include <QPainter>
#include <QTreeView>
#include <QScrollBar>
#include <QUrl>
const char CONSOLE_LOG_BACKGROUND_COLOR[] = "#E8EEF2";
const char CONSOLE_WARNING_BACKGROUND_COLOR[] = "#F6F4EB";
@@ -215,6 +216,9 @@ void QmlConsoleItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem
if (showFileLineInfo) {
// Check for file info
QString file = index.data(QmlConsoleItemModel::FileRole).toString();
const QUrl fileUrl = QUrl(file);
if (fileUrl.isLocalFile())
file = fileUrl.toLocalFile();
if (!file.isEmpty()) {
QFontMetrics fm(option.font);
// Paint FileArea