BornAgain  1.19.0
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/coregui/Views/CommonWidgets/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_COREGUI_VIEWS_COMMONWIDGETS_STATUSLABEL_H
16 #define BORNAGAIN_GUI_COREGUI_VIEWS_COMMONWIDGETS_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 = 0);
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);
41 
42 private:
43  QString m_text;
44  Qt::Alignment m_alignment;
45  QFont m_font;
46 };
47 
48 #endif // BORNAGAIN_GUI_COREGUI_VIEWS_COMMONWIDGETS_STATUSLABEL_H
The StatusLabel class shows a single line of text on a white background.
Definition: StatusLabel.h:28
void setText(const QString &text)
Definition: StatusLabel.cpp:39
void setPointSize(int pointSize)
Definition: StatusLabel.cpp:51
void setFont(const QFont &font)
Definition: StatusLabel.cpp:45
void setAlignment(Qt::Alignment)
Definition: StatusLabel.cpp:57
QString m_text
Definition: StatusLabel.h:43
void paintEvent(QPaintEvent *event)
Definition: StatusLabel.cpp:63
QFont m_font
Definition: StatusLabel.h:45
StatusLabel(QWidget *parent=0)
Definition: StatusLabel.cpp:32
Qt::Alignment m_alignment
Definition: StatusLabel.h:44