Kstars

unitspinboxwidget.h
1 /*
2  SPDX-FileCopyrightText: 2015 Utkarsh Simha <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #ifndef UNITSPINBOXWIDGET_H
8 #define UNITSPINBOXWIDGET_H
9 
10 #include "ui_unitspinboxwidget.h"
11 
12 /**
13  * @brief The UnitSpinBoxWidget class
14  * It is a widget that provides a DoubleSpinBox
15  * and a ComboBox for conversions from different
16  * units.
17  * @author Utkarsh Simha
18  */
19 class UnitSpinBoxWidget : public QWidget
20 {
21  Q_OBJECT
22 
23  public:
24  explicit UnitSpinBoxWidget(QWidget *parent = nullptr);
25  ~UnitSpinBoxWidget() override;
26 
27  /**
28  * @brief addUnit Adds a item to the combo box
29  * @param unitName The name of the unit to be displayed
30  * @param conversionFactor The factor the value of a unit must be multiplied by
31  */
32  void addUnit(const QString &unitName, double conversionFactor);
33 
34  /**
35  * @brief value Returns value upon conversion
36  */
37  double value() const;
38 
39  private:
40  Ui::UnitSpinBoxWidget *ui;
41  QComboBox *comboBox;
42  QDoubleSpinBox *doubleSpinBox;
43 };
44 
45 #endif // UNITSPINBOXWIDGET_H
Q_OBJECTQ_OBJECT
double value() const
value Returns value upon conversion
The UnitSpinBoxWidget class It is a widget that provides a DoubleSpinBox and a ComboBox for conversio...
void addUnit(const QString &unitName, double conversionFactor)
addUnit Adds a item to the combo box
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Fri Sep 29 2023 03:56:59 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.