#include <timeperiod.h>
Inherits TQHBox.
Public Types | |
enum | Units { MINUTES , HOURS_MINUTES , DAYS , WEEKS } |
Signals | |
void | valueChanged (int minutes) |
Public Member Functions | |
TimePeriod (bool allowMinute, TQWidget *parent, const char *name=0) | |
bool | isReadOnly () const |
virtual void | setReadOnly (bool readOnly) |
int | minutes () const |
void | setMinutes (int minutes, bool dateOnly, Units defaultUnits) |
void | setDateOnly (bool dateOnly) |
void | setMaximum (int hourmin, int days) |
void | setSelectOnStep (bool select) |
void | setFocusOnCount () |
void | setWhatsThis (const TQString &units, const TQString &dayWeek, const TQString &hourMin=TQString()) |
Detailed Description
Time period entry widget.
The TimePeriod class provides a widget for entering a time period as a number of weeks, days, hours and minutes, or minutes.
It displays a combo box to select the time units (weeks, days, hours and minutes, or minutes) alongside a spin box to enter the number of units. The type of spin box displayed alters according to the units selection: day, week and minute values are entered in a normal spin box, while hours and minutes are entered in a time spin box (with two pairs of spin buttons, one for hours and one for minutes).
The widget may be set as read-only. This has the same effect as disabling it, except that its appearance is unchanged.
Definition at line 50 of file timeperiod.h.
Member Enumeration Documentation
◆ Units
enum TimePeriod::Units |
Units for the time period.
- MINUTES - the time period is entered as a number of minutes.
- HOURS_MINUTES - the time period is entered as an hours/minutes value.
- DAYS - the time period is entered as a number of days.
- WEEKS - the time period is entered as a number of weeks.
Definition at line 61 of file timeperiod.h.
Constructor & Destructor Documentation
◆ TimePeriod()
TimePeriod::TimePeriod | ( | bool | allowMinute, |
TQWidget * | parent, | ||
const char * | name = 0 |
||
) |
Constructor.
- Parameters
-
allowMinute Set false to prevent hours/minutes or minutes from being allowed as units; only days and weeks can ever be used, regardless of other method calls. Set true to allow minutes, hours/minutes, days or weeks as units. parent The parent object of this widget. name The name of this widget.
Definition at line 53 of file timeperiod.cpp.
Member Function Documentation
◆ isReadOnly()
|
inline |
Returns true if the widget is read only.
Definition at line 73 of file timeperiod.h.
◆ minutes()
int TimePeriod::minutes | ( | ) | const |
Gets the entered time period expressed in minutes.
Definition at line 151 of file timeperiod.cpp.
◆ setDateOnly()
|
inline |
Enables or disables minutes and hours/minutes units in the combo box.
To disable minutes and hours/minutes, set dateOnly
true; to enable minutes and hours/minutes, set dateOnly
false. But note that minutes and hours/minutes cannot be enabled if it was disallowed in the constructor.
Definition at line 92 of file timeperiod.h.
◆ setFocusOnCount()
void TimePeriod::setFocusOnCount | ( | ) |
Sets the input focus to the count field.
Definition at line 121 of file timeperiod.cpp.
◆ setMaximum()
void TimePeriod::setMaximum | ( | int | hourmin, |
int | days | ||
) |
Sets the maximum values for the minutes and hours/minutes, and days/weeks spin boxes.
Set hourmin
= 0 to leave the minutes and hours/minutes maximum unchanged.
Definition at line 130 of file timeperiod.cpp.
◆ setMinutes()
void TimePeriod::setMinutes | ( | int | minutes, |
bool | dateOnly, | ||
TimePeriod::Units | defaultUnits | ||
) |
Initialises the time period value.
- Parameters
-
minutes The value of the time period to set, expressed as a number of minutes. dateOnly True to restrict the units available in the combo box to days or weeks. defaultUnits The units to display initially in the combo box.
Definition at line 170 of file timeperiod.cpp.
◆ setReadOnly()
|
virtual |
Sets whether the widget is read-only for the user.
If read-only, the time period cannot be edited and the units combo box is inactive.
- Parameters
-
readOnly True to set the widget read-only, false to set it read-write.
Definition at line 97 of file timeperiod.cpp.
◆ setSelectOnStep()
void TimePeriod::setSelectOnStep | ( | bool | select | ) |
Sets whether the editor text is to be selected whenever spin buttons are clicked.
The default is to select it.
Definition at line 112 of file timeperiod.cpp.
◆ setWhatsThis()
void TimePeriod::setWhatsThis | ( | const TQString & | units, |
const TQString & | dayWeek, | ||
const TQString & | hourMin = TQString() |
||
) |
Sets separate WhatsThis texts for the count spin boxes and the units combo box.
If hourMin
is omitted, both spin boxes are set to the same WhatsThis text.
Definition at line 379 of file timeperiod.cpp.
◆ valueChanged
|
signal |
This signal is emitted whenever the value held in the widget changes.
- Parameters
-
minutes The current value of the time period, expressed in minutes.
The documentation for this class was generated from the following files: