BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
StatusLabel.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/PlotUtil/StatusLabel.h
6 //! @brief Defines class StatusLabel
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 #ifndef BORNAGAIN_GUI_VIEW_PLOTUTIL_STATUSLABEL_H
16 #define BORNAGAIN_GUI_VIEW_PLOTUTIL_STATUSLABEL_H
17 
18 #include <QFrame>
19 
20 class QPaintEvent;
21 
22 //! The StatusLabel class shows a single line of text on a white background. Opposite to QLabel,
23 //! if text string is too long for current size, it will be clipped.
24 
25 //! This class is intended for ColorMapLabel, where the size of font is adjusted automatically
26 //! depending from available space.
27 
28 class StatusLabel : public QFrame {
29  Q_OBJECT
30 
31 public:
32  explicit StatusLabel(QWidget* parent = nullptr);
33 
34  void setText(const QString& text);
35  void setFont(const QFont& font);
36  void setPointSize(int pointSize);
37  void setAlignment(Qt::Alignment);
38 
39 protected:
40  void paintEvent(QPaintEvent* event) override;
41 
42 private:
43  QString m_text;
44  Qt::Alignment m_alignment;
45  QFont m_font;
46 };
47 
48 #endif // BORNAGAIN_GUI_VIEW_PLOTUTIL_STATUSLABEL_H
The StatusLabel class shows a single line of text on a white background. Opposite to QLabel,...
Definition: StatusLabel.h:28
void setText(const QString &text)
Definition: StatusLabel.cpp:42
void paintEvent(QPaintEvent *event) override
Definition: StatusLabel.cpp:66
void setPointSize(int pointSize)
Definition: StatusLabel.cpp:54
void setFont(const QFont &font)
Definition: StatusLabel.cpp:48
void setAlignment(Qt::Alignment)
Definition: StatusLabel.cpp:60
QString m_text
Definition: StatusLabel.h:43
StatusLabel(QWidget *parent=nullptr)
Definition: StatusLabel.cpp:34
QFont m_font
Definition: StatusLabel.h:45
Qt::Alignment m_alignment
Definition: StatusLabel.h:44