BornAgain
1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
JobMessagePanel.cpp
Go to the documentation of this file.
1
// ************************************************************************************************
2
//
3
// BornAgain: simulate and fit reflection and scattering
4
//
5
//! @file GUI/coregui/Views/JobWidgets/JobMessagePanel.cpp
6
//! @brief Implements class JobMessagePanel
7
//!
8
//! @homepage http://www.bornagainproject.org
9
//! @license GNU General Public License v3 or higher (see COPYING)
10
//! @copyright Forschungszentrum Jülich GmbH 2018
11
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12
//
13
// ************************************************************************************************
14
15
#include "
GUI/coregui/Views/JobWidgets/JobMessagePanel.h
"
16
#include "
GUI/coregui/mainwindow/mainwindow_constants.h
"
17
#include <QScrollBar>
18
#include <QStackedWidget>
19
#include <QTextEdit>
20
#include <QVBoxLayout>
21
22
JobMessagePanel::JobMessagePanel
(QWidget* parent) :
InfoPanel
(parent), m_plainLog(new QTextEdit)
23
{
24
setWindowTitle(
Constants::JobMessagePanelName
);
25
setObjectName(
"JobMessagePanel"
);
26
27
m_plainLog
->setReadOnly(
true
);
28
// m_plainLog->setMaximumBlockCount(100000);
29
QFont f(
"unexistent"
);
30
f.setStyleHint(QFont::Monospace);
31
m_plainLog
->setFont(f);
32
33
m_stackedWidget
->addWidget(
m_plainLog
);
34
35
setContentVisible
(
false
);
36
}
37
38
void
JobMessagePanel::onClearLog
()
39
{
40
m_plainLog
->clear();
41
}
42
43
void
JobMessagePanel::onMessage
(
const
QString& message,
const
QColor& color)
44
{
45
QScrollBar* scrollbar =
m_plainLog
->verticalScrollBar();
46
bool
autoscroll = scrollbar->value() == scrollbar->maximum();
47
// m_plainLog->appendPlainText(message);
48
m_plainLog
->setTextColor(color);
49
m_plainLog
->append(message);
50
if
(autoscroll) {
51
QTextCursor c =
m_plainLog
->textCursor();
52
c.movePosition(QTextCursor::End);
53
m_plainLog
->setTextCursor(c);
54
}
55
}
JobMessagePanel.h
Defines class JobMessagePanel.
InfoPanel
Frame for widgets with tool bar on top and collapse/expand button functionality.
Definition:
InfoPanel.h:29
InfoPanel::m_stackedWidget
QStackedWidget * m_stackedWidget
Definition:
InfoPanel.h:49
InfoPanel::setContentVisible
void setContentVisible(bool editor_status, bool dock_notify=false)
Definition:
InfoPanel.cpp:71
JobMessagePanel::m_plainLog
QTextEdit * m_plainLog
Definition:
JobMessagePanel.h:36
JobMessagePanel::onMessage
void onMessage(const QString &message, const QColor &color=QColor(Qt::black))
Definition:
JobMessagePanel.cpp:43
JobMessagePanel::JobMessagePanel
JobMessagePanel(QWidget *parent=0)
Definition:
JobMessagePanel.cpp:22
JobMessagePanel::onClearLog
void onClearLog()
Definition:
JobMessagePanel.cpp:38
mainwindow_constants.h
Defines namespace Constants.
Constants::JobMessagePanelName
const QString JobMessagePanelName
Definition:
mainwindow_constants.h:66
GUI
coregui
Views
JobWidgets
JobMessagePanel.cpp
Generated by
1.9.1