* Appends \a output to the console and set \a state as user state to * the text block which is needed for the highlighting. */
| 788 | * the text block which is needed for the highlighting. |
| 789 | */ |
| 790 | void PythonConsole::appendOutput(const QString& output, int state) |
| 791 | { |
| 792 | QTextCursor cursor = textCursor(); |
| 793 | cursor.movePosition(QTextCursor::End); |
| 794 | int pos = cursor.position() + 1; |
| 795 | |
| 796 | // delay rehighlighting |
| 797 | cursor.beginEditBlock(); |
| 798 | appendPlainText(output); |
| 799 | |
| 800 | QTextBlock block = this->document()->findBlock(pos); |
| 801 | while (block.isValid()) { |
| 802 | block.setUserState(state); |
| 803 | block = block.next(); |
| 804 | } |
| 805 | cursor.endEditBlock(); // start highlightiong |
| 806 | } |
| 807 | |
| 808 | /** |
| 809 | * Builds up the Python command and pass it to the interpreter. |