Use FileName in TextMark

Change-Id: I3666d95dc8ef3b7da099d6d30f5cb4678a349493
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Eike Ziller
2018-05-02 15:02:00 +02:00
parent 8559df7bc9
commit 45f8d221bf
23 changed files with 84 additions and 65 deletions

View File

@@ -35,13 +35,14 @@
#include <utils/qtcassert.h>
using namespace Utils;
using namespace Valgrind::Internal;
using namespace Valgrind::Callgrind;
namespace Constants { const char CALLGRIND_TEXT_MARK_CATEGORY[] = "Callgrind.Textmark"; }
CallgrindTextMark::CallgrindTextMark(const QPersistentModelIndex &index,
const QString &fileName, int lineNumber)
const FileName &fileName, int lineNumber)
: TextEditor::TextMark(fileName, lineNumber, Constants::CALLGRIND_TEXT_MARK_CATEGORY, 4.0)
, m_modelIndex(index)
{

View File

@@ -45,7 +45,7 @@ public:
* \note The index parameter must refer to one of the DataModel cost columns
*/
explicit CallgrindTextMark(const QPersistentModelIndex &index,
const QString &fileName, int lineNumber);
const Utils::FileName &fileName, int lineNumber);
const Valgrind::Callgrind::Function *function() const;

View File

@@ -848,7 +848,7 @@ void CallgrindTool::requestContextMenu(TextEditorWidget *widget, int line, QMenu
{
// Find callgrind text mark that corresponds to this editor's file and line number
foreach (CallgrindTextMark *textMark, m_textMarks) {
if (textMark->fileName() == widget->textDocument()->filePath().toString() && textMark->lineNumber() == line) {
if (textMark->fileName() == widget->textDocument()->filePath() && textMark->lineNumber() == line) {
const Function *func = textMark->function();
QAction *action = menu->addAction(tr("Select This Function in the Analyzer Output"));
connect(action, &QAction::triggered, this, [this, func] { selectFunction(func); });
@@ -956,7 +956,7 @@ void CallgrindTool::createTextMarks()
continue;
locations << location;
m_textMarks.append(new CallgrindTextMark(index, fileName, lineNumber));
m_textMarks.append(new CallgrindTextMark(index, FileName::fromString(fileName), lineNumber));
}
}