diff options
author | Nikolai Kosjar <nikolai.kosjar@theqtcompany.com> | 2014-11-25 10:49:47 +0100 |
---|---|---|
committer | hjk <hjk121@nokiamail.com> | 2014-11-27 15:06:08 +0100 |
commit | c7c8f88303f11896984bf3c317502bf1b66a2a3a (patch) | |
tree | 513a8815c37ae8d54f7483d172749c03ca5cdf4b | |
parent | c5d86757a1ed7f07cf993bd64e43683475934a4b (diff) | |
download | qt-creator-c7c8f88303f11896984bf3c317502bf1b66a2a3a.tar.gz |
Valgrind: Do not put html links in clipboard
...but plain, canonical and absolute paths if possible.
Change-Id: Ib559f00a55646929b2e548e7e671c1cb5e1d4a79
Reviewed-by: hjk <hjk121@nokiamail.com>
-rw-r--r-- | src/plugins/valgrind/memcheckerrorview.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/plugins/valgrind/memcheckerrorview.cpp b/src/plugins/valgrind/memcheckerrorview.cpp index 33dc3eab24..4be816acc6 100644 --- a/src/plugins/valgrind/memcheckerrorview.cpp +++ b/src/plugins/valgrind/memcheckerrorview.cpp @@ -137,7 +137,8 @@ static QString relativeToPath() } static QString errorLocation(const QModelIndex &index, const Error &error, - bool link = false, const QString &linkAttr = QString()) + bool link = false, bool absolutePath = false, + const QString &linkAttr = QString()) { if (!index.isValid()) return QString(); @@ -149,8 +150,9 @@ static QString errorLocation(const QModelIndex &index, const Error &error, } QTC_ASSERT(model, return QString()); + const QString relativePath = absolutePath ? QString() : relativeToPath(); return QCoreApplication::translate("Valgrind::Internal", "in %1"). - arg(makeFrameName(model->findRelevantFrame(error), relativeToPath(), + arg(makeFrameName(model->findRelevantFrame(error), relativePath, link, linkAttr)); } @@ -181,7 +183,9 @@ QWidget *MemcheckErrorDelegate::createDetailsWidget(const QFont & font, p.setBrush(QPalette::Text, p.highlightedText()); errorLabel->setPalette(p); errorLabel->setText(QString::fromLatin1("%1 <span %4>%2</span>") - .arg(error.what(), errorLocation(errorIndex, error, true, linkStyle), + .arg(error.what(), + errorLocation(errorIndex, error, /*link=*/ true, + /*absolutePath=*/ false, linkStyle), linkStyle)); connect(errorLabel, &QLabel::linkActivated, this, &MemcheckErrorDelegate::openLinkInEditor); @@ -265,17 +269,16 @@ void MemcheckErrorDelegate::copy() const Error error = m_detailsIndex.data(ErrorListModel::ErrorRole).value<Error>(); stream << error.what() << "\n"; - stream << " " << errorLocation(m_detailsIndex, error) << "\n"; - - const QString relativeTo = relativeToPath(); + stream << " " + << errorLocation(m_detailsIndex, error, /*link=*/ false, /*absolutePath=*/ true) + << "\n"; foreach (const Stack &stack, error.stacks()) { if (!stack.auxWhat().isEmpty()) stream << stack.auxWhat(); int i = 1; - foreach (const Frame &frame, stack.frames()) { - stream << " " << i++ << ": " << makeFrameName(frame, relativeTo) << "\n"; - } + foreach (const Frame &frame, stack.frames()) + stream << " " << i++ << ": " << makeFrameName(frame, QString(), false) << "\n"; } stream.flush(); |