forked from qt-creator/qt-creator
Editor: Do not highlight invalid Uses
Invalid Uses (line == 0) are generated by e.g. a Q_D statement.
This kills
1. the selection artifact in line 0, column 0 and
2. the warning "QTextCursor::setPosition: Position '-1' out of range"
for the following example code and cursor position:
void f()
{
Q_D(x)
d->hello(); // put the cursor on the 'd'!
}
Change-Id: I6968cbc261f05e08f71ff125437c8c9e863b475b
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
@@ -1015,8 +1015,10 @@ void CPPEditorWidget::highlightUses(const QList<SemanticInfo::Use> &uses,
|
||||
isUnused = true;
|
||||
|
||||
foreach (const SemanticInfo::Use &use, uses) {
|
||||
QTextEdit::ExtraSelection sel;
|
||||
if (use.isInvalid())
|
||||
continue;
|
||||
|
||||
QTextEdit::ExtraSelection sel;
|
||||
if (isUnused)
|
||||
sel.format = m_occurrencesUnusedFormat;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user