QPlainTextEdit highlight selected line
Hi,
I'm trying to write simple debugger. I'd like to highlight current line when stepping over.
With help of code editor example I was able to do it like this:
Code:
void MainWindow::StepOver_cmd(void)
{
dissasembly_widget->setTextCursor(cursor);
QList<QTextEdit::ExtraSelection> extraSelections;
selection.format.setBackground(lineColor);
selection.
format.
setProperty(QTextFormat::FullWidthSelection,
true);
selection.cursor = cursor;
selection.cursor.clearSelection();
extraSelections.append(selection);
dissasembly_widget->setExtraSelections(extraSelections);
}
but the problem is when user changes cursor position it obviously starts to highlight code in different place.
The problem is with
dissasembly_widget->textCursor(); //dissasembly_widget is QPlainTextEdit
but I dont know how to do it otherwise since there is no setBlock function.
Thanks in advance!