MCPcopy Create free account
hub / github.com/FreeCAD/FreeCAD / customEvent

Method customEvent

src/Gui/ReportView.cpp:557–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

555}
556
557void 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
588bool ReportOutput::event(QEvent* event)

Callers

nothing calls this directly

Calls 9

setParagraphTypeMethod · 0.80
messageTypeMethod · 0.80
GetBoolMethod · 0.80
insertTextMethod · 0.80
typeMethod · 0.45
messageMethod · 0.45
prependMethod · 0.45
toStringMethod · 0.45
documentMethod · 0.45

Tested by

no test coverage detected