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

Method OutputWidget

MiniZincIDE/outputwidget.cpp:23–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

21#include "highlighter.h"
22
23OutputWidget::OutputWidget(QWidget *parent) :
24 QWidget(parent),
25 ui(new Ui::OutputWidget)
26{
27 ui->setupUi(this);
28
29 auto* sectionMenu = new QMenu(this);
30 ui->sectionMenu_pushButton->hide();
31 ui->sectionMenu_pushButton->setMenu(sectionMenu);
32 connect(sectionMenu, &QMenu::aboutToShow, this, [=] () {
33 for (auto* action : sectionMenu->actions()) {
34 action->setChecked(isSectionVisible(action->text()));
35 }
36 });
37
38 auto* messageTypeMenu = new QMenu(this);
39 ui->messageTypeMenu_pushButton->hide();
40 ui->messageTypeMenu_pushButton->setMenu(messageTypeMenu);
41 connect(messageTypeMenu, &QMenu::aboutToShow, this, [=] () {
42 for (auto* action : messageTypeMenu->actions()) {
43 action->setChecked(isMessageTypeVisible(action->text()));
44 }
45 });
46
47 ui->textBrowser->installEventFilter(this);
48 ui->textBrowser->viewport()->installEventFilter(this);
49 ui->textBrowser->setOpenLinks(false);
50 connect(ui->textBrowser, &QTextBrowser::anchorClicked, this, &OutputWidget::onAnchorClicked);
51
52 auto* arrow = new OutputWidgetArrow;
53 arrow->setParent(this);
54 ui->textBrowser->document()->documentLayout()->registerHandler(TextObject::Arrow, arrow);
55 _frame = ui->textBrowser->document()->rootFrame();
56
57 _headerTableFormat.setWidth(QTextLength(QTextLength::PercentageLength, 100));
58 _headerTableFormat.setBorder(0);
59 _headerTableFormat.setCellSpacing(0);
60 _headerTableFormat.setProperty(Property::ToggleFrame, true);
61
62 QFontMetrics metrics(ui->textBrowser->font());
63 auto spaceNeeded = metrics.height() + 4;
64 auto cwc = { QTextLength(QTextLength::FixedLength, spaceNeeded) };
65 _headerTableFormat.setColumnWidthConstraints(cwc);
66
67 _arrowFormat.setObjectType(TextObject::Arrow);
68 _arrowFormat.setForeground(Qt::gray);
69
70 _frameFormat.setLeftMargin(spaceNeeded);
71 _frameFormat.setProperty(Property::Expanded, true);
72
73 _rightAlignBlockFormat.setAlignment(Qt::AlignRight);
74 _rightAlignBlockFormat.setLeftMargin(10);
75#ifdef Q_OS_MAC
76 ui->toggleAll_pushButton->setMinimumWidth(85);
77 layout()->setSpacing(8);
78
79 ui->buttons_widget->setAttribute(Qt::WA_LayoutUsesWidgetRect);
80 ui->sectionButtons_widget->setAttribute(Qt::WA_LayoutUsesWidgetRect);

Callers

nothing calls this directly

Calls 2

setWidthMethod · 0.80
heightMethod · 0.45

Tested by

no test coverage detected