diff options
author | Aurindam Jana <aurindam.jana@digia.com> | 2013-05-24 16:31:01 +0200 |
---|---|---|
committer | Kai Koehne <kai.koehne@digia.com> | 2013-06-04 12:11:36 +0200 |
commit | b0854e3c71803c8397f9bb48b8766c151b6e0edd (patch) | |
tree | 9e820e8f6691f5be9ee7bd60c3b9662343ed751d /src/plugins/qmljstools/qmlconsoleview.cpp | |
parent | 25dd94808d0fee8ea3aa949d4d9ae17cac5ffd6c (diff) | |
download | qt-creator-b0854e3c71803c8397f9bb48b8766c151b6e0edd.tar.gz |
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>
Diffstat (limited to 'src/plugins/qmljstools/qmlconsoleview.cpp')
-rw-r--r-- | src/plugins/qmljstools/qmlconsoleview.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/src/plugins/qmljstools/qmlconsoleview.cpp b/src/plugins/qmljstools/qmlconsoleview.cpp index 50d45b1c28..87916e1815 100644 --- a/src/plugins/qmljstools/qmlconsoleview.cpp +++ b/src/plugins/qmljstools/qmlconsoleview.cpp @@ -226,8 +226,10 @@ void QmlConsoleView::onRowActivated(const QModelIndex &index) return; // See if we have file and line Info - QString filePath = model()->data(index, - QmlConsoleItemModel::FileRole).toString(); + QString filePath = model()->data(index, QmlConsoleItemModel::FileRole).toString(); + const QUrl fileUrl = QUrl(filePath); + if (fileUrl.isLocalFile()) + filePath = fileUrl.toLocalFile(); if (!filePath.isEmpty()) { QFileInfo fi(filePath); if (fi.exists() && fi.isFile() && fi.isReadable()) { @@ -245,6 +247,9 @@ void QmlConsoleView::copyToClipboard(const QModelIndex &index) QString contents = model()->data(index, QmlConsoleItemModel::ExpressionRole).toString(); // See if we have file and line Info QString filePath = model()->data(index, QmlConsoleItemModel::FileRole).toString(); + const QUrl fileUrl = QUrl(filePath); + if (fileUrl.isLocalFile()) + filePath = fileUrl.toLocalFile(); if (!filePath.isEmpty()) { contents = QString(QLatin1String("%1 %2: %3")).arg(contents).arg(filePath).arg( model()->data(index, QmlConsoleItemModel::LineRole).toString()); @@ -260,6 +265,9 @@ bool QmlConsoleView::canShowItemInTextEditor(const QModelIndex &index) // See if we have file and line Info QString filePath = model()->data(index, QmlConsoleItemModel::FileRole).toString(); + const QUrl fileUrl = QUrl(filePath); + if (fileUrl.isLocalFile()) + filePath = fileUrl.toLocalFile(); if (!filePath.isEmpty()) { QFileInfo fi(filePath); if (fi.exists() && fi.isFile() && fi.isReadable()) |