Kstars

timestepbox.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 <QWidget>
10 
11 class QHBoxLayout;
12 
13 class TimeSpinBox;
14 class TimeUnitBox;
15 
16 /**
17  * @class TimeStepBox
18  * @short Composite spinbox for specifying a time step.
19  * This composite widget consists of a TimeSpinBox (a QSpinBox), coupled with a
20  * TimeUnitBox (a second pair of up/down buttons).
21  * The second set of buttons makes larger steps through the 82 possible
22  * time-step values, skipping to the next even unit of time.
23  *
24  * @author Jason Harris
25  * @version 1.0
26  */
27 class TimeStepBox : public QWidget
28 {
29  Q_OBJECT
30  public:
31  /** Constructor. */
32  explicit TimeStepBox(QWidget *parent = nullptr, bool daysonly = false);
33 
34  /** @return a pointer to the child TimeSpinBox */
35  TimeSpinBox *tsbox() const { return timeBox; }
36 
37  /** @return a pointer to the child TimeUnitBox */
38  TimeUnitBox *unitbox() const { return unitBox; }
39 
40  bool daysOnly() const { return DaysOnly; }
41  void setDaysOnly(bool daysonly);
42 
43  signals:
44  void scaleChanged(float);
45 
46  private slots:
47  /**
48  * Set the TimeSpinBox value according to the current UnitBox value.
49  * This is connected to the UnitBox valueChanged() Signal.
50  */
51  void changeUnits(void);
52 
53  /**
54  * Make sure the current UnitBox value represents the correct units for the
55  * current TimeBox value. This slot is connected to the TimeBox valueChanged() Slot.
56  */
57  void syncUnits(int);
58 
59  private:
60  bool DaysOnly { false };
61  QHBoxLayout *hlay { nullptr };
62  TimeSpinBox *timeBox { nullptr };
63  TimeUnitBox *unitBox { nullptr };
64 };
Q_OBJECTQ_OBJECT
TimeStepBox(QWidget *parent=nullptr, bool daysonly=false)
Constructor.
Definition: timestepbox.cpp:17
Provides a second set of up/down buttons for TimeStepBox. A pair of buttons, arranged one above the o...
Definition: timeunitbox.h:37
Composite spinbox for specifying a time step. This composite widget consists of a TimeSpinBox (a QSpi...
Definition: timestepbox.h:27
TimeSpinBox * tsbox() const
Definition: timestepbox.h:35
TimeUnitBox * unitbox() const
Definition: timestepbox.h:38
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:58 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.