Commit 2ec2e907 authored by Alexander Neundorf's avatar Alexander Neundorf Committed by Alexander Neundorf
Browse files

Search&Replace add "Role" to LastMatchedRangeInFile

All other values of MatchDataRoles also end with "Role"
parent ac51ba10
Pipeline #145596 passed with stage
in 2 minutes and 22 seconds
......@@ -939,7 +939,7 @@ QVariant MatchModel::data(const QModelIndex &index, int role) const
return m_matchFiles[fileRow].fileUrl;
case PlainTextRole:
return fileToPlainText(m_matchFiles[fileRow]);
case LastMatchedRangeInFile:
case LastMatchedRangeInFileRole:
if (m_matchFiles[fileRow].matches.isEmpty()) {
qWarning() << "Unexpected empty matches for file!";
return {};
......@@ -980,7 +980,7 @@ QVariant MatchModel::data(const QModelIndex &index, int role) const
return matchToPlainText(match);
case MatchItem:
return QVariant::fromValue(match);
case LastMatchedRangeInFile:
case LastMatchedRangeInFileRole:
qWarning() << "Requested last matched line from a match item instead of file item1";
return {};
}
......
......@@ -60,7 +60,7 @@ public:
ReplaceTextRole,
PlainTextRole,
MatchItem,
LastMatchedRangeInFile,
LastMatchedRangeInFileRole,
};
Q_ENUM(MatchDataRoles)
......
......@@ -51,7 +51,7 @@ SearchResultsDelegate::SearchResultsDelegate(QObject *parent)
static int lineNumAreaWidth(const QModelIndex &index, const QFontMetrics &fm)
{
const auto lastRangeForFile = index.parent().data(MatchModel::LastMatchedRangeInFile).value<KTextEditor::Range>();
const auto lastRangeForFile = index.parent().data(MatchModel::LastMatchedRangeInFileRole).value<KTextEditor::Range>();
const QString lineCol = QStringLiteral("%1:%2").arg(lastRangeForFile.start().line() + 1).arg(lastRangeForFile.start().column() + 1);
return fm.horizontalAdvance(lineCol);
}
......
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