2 * This file is part of the SmuView project.
4 * Copyright (C) 2019-2022 Frank Stettner <frank-stettner@gmx.net>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 #ifndef UI_WIDGETS_MONOFONTDISPLAY_HPP
21 #define UI_WIDGETS_MONOFONTDISPLAY_HPP
25 #include <QGridLayout>
27 #include <QSpacerItem>
34 enum class MonoFontDisplayType
{
36 AutoRangeWithSRDigits
,
40 class MonoFontDisplay
: public QFrame
45 MonoFontDisplay(const MonoFontDisplayType display_type
,
46 const QString
&unit
, const QString
&unit_suffix
,
47 const QString
&extra_text
, const bool small
, QWidget
*parent
= nullptr);
52 const MonoFontDisplayType display_type_
;
54 bool total_digits_changed_
;
58 bool extra_text_changed_
;
60 QString unit_si_prefix_
;
70 QSpacerItem
*extra_spacer_
;
73 virtual void setup_ui();
74 void update_value_widget_dimensions();
75 void update_extra_widget_dimensions();
76 void update_unit_widget_dimensions();
77 void show_value(const QString
&value
);
78 void show_extra_text(const QString
&extra_text
);
79 void show_unit(const QString
&unit
);
82 void set_value(const double value
);
83 void set_extra_text(const QString
&extra_text
);
84 void set_unit(const QString
&unit
);
85 void set_unit_suffix(const QString
&unit_suffix
);
86 void set_sr_digits(const int total_digits
, const int sr_digits
);
87 void set_decimal_places(const int total_digits
, const int decimal_places
);
89 void update_display();
93 } // namespace widgets
97 #endif // UI_WIDGETS_MONOFONTDISPLAY_HPP