| 555 | } |
| 556 | |
| 557 | void ReportOutput::customEvent(QEvent* ev) |
| 558 | { |
| 559 | // Appends the text stored in the event to the text view |
| 560 | if (ev->type() == QEvent::User) { |
| 561 | auto ce = static_cast<CustomReportEvent*>(ev); |
| 562 | reportHl->setParagraphType(ce->messageType()); |
| 563 | |
| 564 | bool showTimecode = getWindowParameter()->GetBool("checkShowReportTimecode", true); |
| 565 | QString text = ce->message(); |
| 566 | |
| 567 | // The time code can only be set when the cursor is at the block start |
| 568 | if (showTimecode && blockStart) { |
| 569 | QTime time = QTime::currentTime(); |
| 570 | text.prepend(time.toString(QLatin1String("hh:mm:ss "))); |
| 571 | } |
| 572 | |
| 573 | QTextCursor cursor(this->document()); |
| 574 | cursor.beginEditBlock(); |
| 575 | cursor.movePosition(QTextCursor::End); |
| 576 | cursor.insertText(text); |
| 577 | cursor.endEditBlock(); |
| 578 | |
| 579 | blockStart = cursor.atBlockStart(); |
| 580 | if (gotoEnd) { |
| 581 | setTextCursor(cursor); |
| 582 | } |
| 583 | ensureCursorVisible(); |
| 584 | } |
| 585 | } |
| 586 | |
| 587 | |
| 588 | bool ReportOutput::event(QEvent* event) |
nothing calls this directly
no test coverage detected