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:

Qt Code:
  1. void MainWindow::StepOver_cmd(void)
  2. {
  3.  
  4. QTextCursor cursor = dissasembly_widget->textCursor();
  5.  
  6. cursor.movePosition(QTextCursor::Down, QTextCursor::MoveAnchor);
  7. dissasembly_widget->setTextCursor(cursor);
  8.  
  9. QList<QTextEdit::ExtraSelection> extraSelections;
  10. QTextEdit::ExtraSelection selection;
  11. QColor lineColor = QColor(Qt::cyan).darker(200);
  12. selection.format.setBackground(lineColor);
  13. selection.format.setProperty(QTextFormat::FullWidthSelection, true);
  14. selection.cursor = cursor;
  15.  
  16. selection.cursor.clearSelection();
  17. extraSelections.append(selection);
  18. dissasembly_widget->setExtraSelections(extraSelections);
  19.  
  20. }
To copy to clipboard, switch view to plain text mode 

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!