kalarm/lib

TimePeriod Class Reference

#include <timeperiod.h>

List of all members.


Detailed Description

Time period entry widget.

The TimePeriod class provides a widget for entering a time period as a number of weeks, days, or hours and minutes.

It displays a combo box to select the time units (weeks, days or hours and minutes) alongside a spin box to enter the number of units. The type of spin box displayed alters according to the units selection: day and week 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.

Author:
David Jarvie <software@astrojar.org.uk>

Definition at line 50 of file timeperiod.h.


Public Types

enum  Units { HOURS_MINUTES, DAYS, WEEKS }

Signals

void valueChanged (int minutes)

Public Member Functions

 TimePeriod (bool allowHourMinute, QWidget *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 QString &units, const QString &dayWeek, const QString &hourMin=QString::null)

Static Public Member Functions

static QString i18n_hours_mins ()
static QString i18n_Hours_Mins ()
static QString i18n_days ()
static QString i18n_Days ()
static QString i18n_weeks ()
static QString i18n_Weeks ()

Member Enumeration Documentation

Units for the time period.

  • 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 59 of file timeperiod.h.


Constructor & Destructor Documentation

TimePeriod::TimePeriod ( bool  allowHourMinute,
QWidget *  parent,
const char *  name = 0 
)

Constructor.

Parameters:
allowHourMinute Set false to prevent hours/minutes from being allowed as units; only days and weeks can ever be used, regardless of other method calls. Set true to allow hours/minutes, days or weeks as units.
parent The parent object of this widget.
name The name of this widget.

Definition at line 51 of file timeperiod.cpp.


Member Function Documentation

bool TimePeriod::isReadOnly (  )  const [inline]

Returns true if the widget is read only.

Definition at line 70 of file timeperiod.h.

void TimePeriod::setReadOnly ( bool  readOnly  )  [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 94 of file timeperiod.cpp.

int TimePeriod::minutes (  )  const

Gets the entered time period expressed in minutes.

Definition at line 148 of file timeperiod.cpp.

void TimePeriod::setMinutes ( int  minutes,
bool  dateOnly,
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 167 of file timeperiod.cpp.

void TimePeriod::setDateOnly ( bool  dateOnly  )  [inline]

Enables or disables hours/minutes units in the combo box.

To disable hours/minutes, set dateOnly true; to enable hours/minutes, set dateOnly false. But note that hours/minutes cannot be enabled if it was disallowed in the constructor.

Definition at line 88 of file timeperiod.h.

void TimePeriod::setMaximum ( int  hourmin,
int  days 
)

Sets the maximum values for the hours/minutes and days/weeks spin boxes.

Set hourmin = 0 to leave the hours/minutes maximum unchanged.

Definition at line 127 of file timeperiod.cpp.

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 109 of file timeperiod.cpp.

void TimePeriod::setFocusOnCount (  ) 

Sets the input focus to the count field.

Definition at line 118 of file timeperiod.cpp.

void TimePeriod::setWhatsThis ( const QString &  units,
const QString &  dayWeek,
const QString &  hourMin = QString::null 
)

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 369 of file timeperiod.cpp.

void TimePeriod::valueChanged ( int  minutes  )  [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:
KDE Home | KDE Accessibility Home | Description of Access Keys