MCPcopy Create free account
hub / github.com/MiniZinc/MiniZincIDE / toggleFrameVisibility

Method toggleFrameVisibility

MiniZincIDE/outputwidget.cpp:597–636  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

595}
596
597void OutputWidget::toggleFrameVisibility(QTextFrame* frame)
598{
599 TextLayoutLock lock(this, false);
600 auto frameFormat = frame->frameFormat();
601 auto visible = !frameFormat.property(Property::Expanded).toBool();
602 frameFormat.setProperty(Property::Expanded, visible);
603 frame->setFrameFormat(frameFormat);
604
605 auto parentVisible = isFrameVisible(frame->parentFrame());
606 if (!parentVisible) {
607 return;
608 }
609
610 // Set visibility of TextBlocks
611 auto cursor = frame->firstCursorPosition();
612 auto end = frame->lastCursorPosition();
613 while (cursor <= end) {
614 auto* childFrame = cursor.currentFrame();
615 if (childFrame != nullptr && childFrame != frame) {
616 auto childFormat = frame->frameFormat();
617 auto childVisible = !childFormat.property(Property::Expanded).toBool();
618 if (childVisible == visible) {
619 cursor = childFrame->lastCursorPosition();
620 cursor.movePosition(QTextCursor::NextBlock);
621 continue;
622 }
623 }
624
625 auto block = cursor.block();
626 auto blockFormat = block.blockFormat();
627 auto blockVisible = true;
628 if (blockFormat.hasProperty(Property::Section)) {
629 blockVisible = _sections[blockFormat.property(Property::Section).toString()];
630 } else if (blockFormat.hasProperty(Property::MessageType)) {
631 blockVisible = _messageTypeVisible[blockFormat.property(Property::MessageType).toString()];
632 }
633 block.setVisible(isFrameVisible(cursor.currentFrame()) && blockVisible);
634 cursor.movePosition(QTextCursor::NextBlock);
635 }
636}
637
638void OutputWidget::addSection(const QString& section)
639{

Callers 1

TextLayoutLockMethod · 0.80

Calls 2

frameFormatMethod · 0.80
toStringMethod · 0.45

Tested by

no test coverage detected