Commit c90815e2 authored by Nikolai Kosjar's avatar Nikolai Kosjar

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()
        d->hello(); // put the cursor on the 'd'!

Change-Id: I6968cbc261f05e08f71ff125437c8c9e863b475b
Reviewed-by: default avatarErik Verbruggen <>
parent 30da7ad3
......@@ -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())
QTextEdit::ExtraSelection sel;
if (isUnused)
sel.format = m_occurrencesUnusedFormat;
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