Kstars

timestepbox.h
1/*
2 SPDX-FileCopyrightText: 2002 Jason Harris <kstars@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include <QWidget>
10
11class QHBoxLayout;
12
13class TimeSpinBox;
14class 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 */
27class TimeStepBox : public QWidget
28{
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};
Custom spinbox to handle selection of timestep values with variable units.
Composite spinbox for specifying a time step.
Definition timestepbox.h:28
TimeUnitBox * unitbox() const
Definition timestepbox.h:38
TimeSpinBox * tsbox() const
Definition timestepbox.h:35
TimeStepBox(QWidget *parent=nullptr, bool daysonly=false)
Constructor.
Provides a second set of up/down buttons for TimeStepBox.
Definition timeunitbox.h:38
Q_OBJECTQ_OBJECT
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 4 2024 16:38:44 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.