BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
FontScalingEvent.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/View/PlotUtil/FontScalingEvent.h
6 //! @brief Defines class FontScalingEvent
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_FONTSCALINGEVENT_H
16 #define BORNAGAIN_GUI_VIEW_PLOTUTIL_FONTSCALINGEVENT_H
17 
18 #include <QFont>
19 #include <QMap>
20 #include <QObject>
21 
22 class QEvent;
23 class ScientificPlot;
24 
25 //! Provides event filter for ScientificPlot. Its goal is to make font size adjustments
26 //! on resize events.
27 
28 class FontScalingEvent : public QObject {
29  Q_OBJECT
30 
31 public:
32  explicit FontScalingEvent(ScientificPlot* plot, QWidget* parent);
33 
34 protected:
35  bool eventFilter(QObject* obj, QEvent* event) override;
36 
37 private:
38  void backupFonts();
39  void restoreFonts();
40  void scaleFonts(double factor);
41  void setTickLabelFont(const QFont& font);
42 
44  QMap<QString, QFont> m_fonts;
45 };
46 
47 #endif // BORNAGAIN_GUI_VIEW_PLOTUTIL_FONTSCALINGEVENT_H
Provides event filter for ScientificPlot. Its goal is to make font size adjustments on resize events.
ScientificPlot * m_plot
bool eventFilter(QObject *obj, QEvent *event) override
void setTickLabelFont(const QFont &font)
void scaleFonts(double factor)
FontScalingEvent(ScientificPlot *plot, QWidget *parent)
QMap< QString, QFont > m_fonts
void backupFonts()
Backup all fonts.
Common interface for plot-descriptor interaction.