Kstars

timespinbox.h
1 /*
2  SPDX-FileCopyrightText: 2002 Jason Harris <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #pragma once
8 
9 #include <QSpinBox>
10 #include <QStringList>
11 
12 /**
13  * @class TimeSpinBox
14  * Custom spinbox to handle selection of timestep values with variable units.
15  * @note this should only be used internally, embedded in a TimeStepBox widget.
16  *
17  * @author Jason Harris
18  * @version 1.0
19  */
20 class TimeSpinBox : public QSpinBox
21 {
22  Q_OBJECT
23  public:
24  /** Constructor */
25  explicit TimeSpinBox(QWidget *parent, bool daysOnly = false);
26  /** Destructor (empty) */
27  ~TimeSpinBox() override = default;
28 
29  /**
30  * Convert the internal value to a display string.
31  * @note reimplemented from QSpinBox
32  * @p value the internal value to convert to a display string
33  * @return the display string
34  */
35  QString textFromValue(int value) const override;
36 
37  /**
38  * Convert the displayed string to an internal value.
39  * @note reimplemented from QSpinBox
40  * @p ok bool pointer set to true if conversion was successful
41  * @return internal value converted from displayed text
42  */
43  int valueFromText(const QString &text) const override;
44 
45  /** @return the current TimeStep setting */
46  float timeScale() const;
47 
48  void setDaysOnly(bool daysonly);
49  bool daysOnly() const { return DaysOnly; }
50 
51  signals:
52  void scaleChanged(float s);
53 
54  public slots:
55  void changeScale(float s);
56 
57  protected slots:
58  void reportChange();
59 
60  private:
61  bool DaysOnly { false };
62  float TimeScale[43];
63  QStringList TimeString;
64 };
~TimeSpinBox() override=default
Destructor (empty)
TimeSpinBox(QWidget *parent, bool daysOnly=false)
Constructor.
Definition: timespinbox.cpp:30
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Mon Aug 15 2022 04:04:06 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.