MCPcopy Create free account
hub / github.com/colmap/colmap / LogWidget

Method LogWidget

src/colmap/ui/log_widget.cc:85–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

83} // namespace
84
85LogWidget::LogWidget(QWidget* parent, const int max_num_blocks) {
86 setWindowFlags(Qt::Window);
87 setWindowTitle("Log");
88 resize(320, parent->height());
89
90 QGridLayout* grid = new QGridLayout(this);
91 grid->setContentsMargins(5, 10, 5, 5);
92
93 qRegisterMetaType<QTextCursor>("QTextCursor");
94 qRegisterMetaType<QTextBlock>("QTextBlock");
95
96 QTimer* timer = new QTimer(this);
97 connect(timer, &QTimer::timeout, this, &LogWidget::Flush);
98 timer->start(100);
99
100 log_sink_ = std::make_unique<GlogSink>(this);
101
102 QHBoxLayout* left_button_layout = new QHBoxLayout();
103
104 QPushButton* clear_button = new QPushButton(tr("Clear"), this);
105 connect(clear_button, &QPushButton::released, this, &LogWidget::Clear);
106 left_button_layout->addWidget(clear_button);
107
108 grid->addLayout(left_button_layout, 0, 0, Qt::AlignLeft);
109
110 QHBoxLayout* right_button_layout = new QHBoxLayout();
111
112 grid->addLayout(right_button_layout, 0, 1, Qt::AlignRight);
113
114 text_box_ = new QPlainTextEdit(this);
115 text_box_->setReadOnly(true);
116 text_box_->setMaximumBlockCount(max_num_blocks);
117 text_box_->setWordWrapMode(QTextOption::NoWrap);
118 QFont font = QFontDatabase::systemFont(QFontDatabase::FixedFont);
119 font.setPointSize(10);
120 text_box_->setFont(font);
121 grid->addWidget(text_box_, 1, 0, 1, 2);
122}
123
124void LogWidget::Append(google::LogSeverity severity, std::string text) {
125 QMutexLocker locker(&mutex_);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected