• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

Public Types | Public Slots | Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
KDateTimeEdit Class Reference

#include <kdatetimeedit.h>

Inheritance diagram for KDateTimeEdit:
Inheritance graph
[legend]

Public Types

enum  Option {
  ShowCalendar = 0x00001, ShowDate = 0x00002, ShowTime = 0x00004, ShowTimeSpec = 0x00008,
  EditDate = 0x00020, EditTime = 0x00040, SelectCalendar = 0x00100, SelectDate = 0x00200,
  SelectTime = 0x00400, SelectTimeSpec = 0x00800, DatePicker = 0x01000, DateKeywords = 0x02000,
  ForceTime = 0x04000, WarnOnInvalid = 0x08000
}
 

Public Slots

void resetDateTimeRange ()
 
void resetMaximumDateTime ()
 
void resetMinimumDateTime ()
 
void setCalendar (KCalendarSystem *calendar=0)
 
void setCalendarSystem (KLocale::CalendarSystem calendarSystem)
 
void setCalendarSystemsList (QList< KLocale::CalendarSystem > calendars)
 
void setDate (const QDate &date)
 
void setDateDisplayFormat (KLocale::DateFormat format)
 
void setDateMap (QMap< QDate, QString > dateMap)
 
void setDateTime (const KDateTime &dateTime)
 
void setDateTimeRange (const KDateTime &minDateTime, const KDateTime &maxDateTime, const QString &minWarnMsg=QString(), const QString &maxWarnMsg=QString())
 
void setMaximumDateTime (const KDateTime &maxDateTime, const QString &maxWarnMsg=QString())
 
void setMinimumDateTime (const KDateTime &minDateTime, const QString &minWarnMsg=QString())
 
void setOptions (Options options)
 
void setTime (const QTime &time)
 
void setTimeDisplayFormat (KLocale::TimeFormatOptions formatOptions)
 
void setTimeList (QList< QTime > timeList, const QString &minWarnMsg=QString(), const QString &maxWarnMsg=QString())
 
void setTimeListInterval (int minutes)
 
void setTimeSpec (const KDateTime::Spec &spec)
 
void setTimeZones (const KTimeZones::ZoneMap &zones)
 

Signals

void calendarChanged (KLocale::CalendarSystem calendarSystem)
 
void calendarEntered (KLocale::CalendarSystem calendarSystem)
 
void dateChanged (const QDate &date)
 
void dateEdited (const QDate &date)
 
void dateEntered (const QDate &date)
 
void dateTimeChanged (const KDateTime &dateTime)
 
void dateTimeEdited (const KDateTime &dateTime)
 
void dateTimeEntered (const KDateTime &dateTime)
 
void timeChanged (const QTime &time)
 
void timeEdited (const QTime &time)
 
void timeEntered (const QTime &time)
 
void timeSpecChanged (const KDateTime::Spec &spec)
 
void timeSpecEntered (const KDateTime::Spec &spec)
 

Public Member Functions

 KDateTimeEdit (QWidget *parent=0)
 
virtual ~KDateTimeEdit ()
 
const KCalendarSystem * calendar () const
 
KLocale::CalendarSystem calendarSystem () const
 
QList< KLocale::CalendarSystem > calendarSystemsList () const
 
QDate date () const
 
KLocale::DateFormat dateDisplayFormat () const
 
QMap< QDate, QString > dateMap () const
 
KDateTime dateTime () const
 
bool isNull () const
 
bool isNullDate () const
 
bool isNullTime () const
 
bool isValid () const
 
bool isValidDate () const
 
bool isValidTime () const
 
KDateTime maximumDateTime () const
 
KDateTime minimumDateTime () const
 
Options options () const
 
QTime time () const
 
KLocale::TimeFormatOptions timeDisplayFormat () const
 
QList< QTime > timeList () const
 
int timeListInterval () const
 
KDateTime::Spec timeSpec () const
 
KTimeZones::ZoneMap timeZones () const
 

Protected Member Functions

void assignCalendarSystem (KLocale::CalendarSystem calendarSystem)
 
virtual void assignDate (const QDate &date)
 
virtual void assignDateTime (const KDateTime &dateTime)
 
virtual void assignTime (const QTime &time)
 
void assignTimeSpec (const KDateTime::Spec &spec)
 
virtual bool eventFilter (QObject *object, QEvent *event)
 
virtual void focusInEvent (QFocusEvent *event)
 
virtual void focusOutEvent (QFocusEvent *event)
 
virtual void resizeEvent (QResizeEvent *event)
 

Properties

QDate date
 
Options options
 
QTime time
 
int timeListInterval
 

Detailed Description

Definition at line 33 of file kdatetimeedit.h.

Member Enumeration Documentation

enum KDateTimeEdit::Option

Options provided by the widget.

See also
options
setOptions
Enumerator
ShowCalendar 

If the Calendar System edit is displayed.

ShowDate 

If the Date is displayed.

ShowTime 

If the Time is displayed.

ShowTimeSpec 

If the Time Spec is displayed.

EditDate 

Allow the user to manually edit the date.

EditTime 

Allow the user to manually edit the time.

SelectCalendar 

Allow the user to select a calendar.

SelectDate 

Allow the user to select a date.

SelectTime 

Allow the user to select a time.

SelectTimeSpec 

Allow the user to select a time spec.

DatePicker 

Show a date picker.

DateKeywords 

Show date keywords.

ForceTime 

The entered time can only be a selected time.

WarnOnInvalid 

Show a warning on focus out if the date or time is invalid.

Definition at line 50 of file kdatetimeedit.h.

Constructor & Destructor Documentation

KDateTimeEdit::KDateTimeEdit ( QWidget *  parent = 0)
explicit

Create a new KDateTimeEdit widget.

Definition at line 264 of file kdatetimeedit.cpp.

KDateTimeEdit::~KDateTimeEdit ( )
virtual

Destroy the widget.

Definition at line 286 of file kdatetimeedit.cpp.

Member Function Documentation

void KDateTimeEdit::assignCalendarSystem ( KLocale::CalendarSystem  calendarSystem)
protected

Assign the calendar system for the widget.

Virtual to allow sub-classes to apply extra validation rules, but reimplementations must call the parent method at the end.

Parameters
calendarSystemthe new calendar system

Definition at line 404 of file kdatetimeedit.cpp.

void KDateTimeEdit::assignDate ( const QDate &  date)
protectedvirtual

Assign the date for the widget.

Virtual to allow sub-classes to apply extra validation rules, but reimplementations must call the parent method at the end.

Parameters
datethe new date

Definition at line 387 of file kdatetimeedit.cpp.

void KDateTimeEdit::assignDateTime ( const KDateTime &  dateTime)
protectedvirtual

Assign the date, time and time spec for the widget.

Virtual to allow sub-classes to apply extra validation rules, but reimplementations must call the parent method at the end.

Parameters
datetimethe new date and time

Definition at line 371 of file kdatetimeedit.cpp.

void KDateTimeEdit::assignTime ( const QTime &  time)
protectedvirtual

Assign the time for the widget.

Virtual to allow sub-classes to apply extra validation rules, but reimplementations must call the parent method at the end.

Parameters
timethe new time

Definition at line 425 of file kdatetimeedit.cpp.

void KDateTimeEdit::assignTimeSpec ( const KDateTime::Spec &  spec)
protected

Assign the time spec for the widget.

Virtual to allow sub-classes to apply extra validation rules, but reimplementations must call the parent method at the end.

Parameters
specthe new time spec

Definition at line 442 of file kdatetimeedit.cpp.

const KCalendarSystem* KDateTimeEdit::calendar ( ) const

Returns a pointer to the Calendar System object used by this widget.

Usually this will be the Global Calendar System using the Global Locale, but this may have been changed to a custom Calendar System possibly using a custom Locale.

Normally you will not need to access this object.

See also
KCalendarSystem
setCalendar
Returns
the current calendar system instance
void KDateTimeEdit::calendarChanged ( KLocale::CalendarSystem  calendarSystem)
signal

Signal if the Calendar System has been changed either manually by the user or programatically.

Parameters
calendarSystemthe new calendar system
void KDateTimeEdit::calendarEntered ( KLocale::CalendarSystem  calendarSystem)
signal

Signal if the Calendar System has been manually entered by the user.

Parameters
calendarSystemthe new calendar system
KLocale::CalendarSystem KDateTimeEdit::calendarSystem ( ) const

Returns the Calendar System type used by the widget.

See also
KLocale::CalendarSystem
setCalendarSystem()
Returns
the Calendar System currently used

Definition at line 296 of file kdatetimeedit.cpp.

QList< KLocale::CalendarSystem > KDateTimeEdit::calendarSystemsList ( ) const

Returns the list of Calendar Systems displayed.

Parameters
calendarsthe list of calendar systems to display

Definition at line 510 of file kdatetimeedit.cpp.

QDate KDateTimeEdit::date ( ) const

Return the currently selected date.

Returns
the currently selected date
void KDateTimeEdit::dateChanged ( const QDate &  date)
signal

Signal if the date has been changed either manually by the user or programatically.

The returned date may be invalid.

Parameters
datethe new date
KLocale::DateFormat KDateTimeEdit::dateDisplayFormat ( ) const

Return the currently set date display format.

By default this is the Short Date

Returns
the currently set date format

Definition at line 520 of file kdatetimeedit.cpp.

void KDateTimeEdit::dateEdited ( const QDate &  date)
signal

Signal if the date is being manually edited by the user.

The returned date may be invalid.

Parameters
datethe new date
void KDateTimeEdit::dateEntered ( const QDate &  date)
signal

Signal if the date has been manually entered by the user.

The returned date may be invalid.

Parameters
datethe new date
QMap< QDate, QString > KDateTimeEdit::dateMap ( ) const

Return the map of dates listed in the drop-down and their displayed string forms.

See also
setDateMap()
Returns
the select date map

Definition at line 530 of file kdatetimeedit.cpp.

KDateTime KDateTimeEdit::dateTime ( ) const

Return the currently selected date, time and time spec.

Returns
the currently selected date, time and time spec

Definition at line 291 of file kdatetimeedit.cpp.

void KDateTimeEdit::dateTimeChanged ( const KDateTime &  dateTime)
signal

Signal if the date or time has been changed either manually by the user or programatically.

The returned date and time may be invalid.

Parameters
dateTimethe new date, time and time spec
void KDateTimeEdit::dateTimeEdited ( const KDateTime &  dateTime)
signal

Signal if the date or time is being manually edited by the user.

The returned date and time may be invalid.

Parameters
dateTimethe new date, time and time spec
void KDateTimeEdit::dateTimeEntered ( const KDateTime &  dateTime)
signal

Signal if the date or time has been manually entered by the user.

The returned date and time may be invalid.

Parameters
dateTimethe new date, time and time spec
bool KDateTimeEdit::eventFilter ( QObject *  object,
QEvent *  event 
)
protectedvirtual

Definition at line 580 of file kdatetimeedit.cpp.

void KDateTimeEdit::focusInEvent ( QFocusEvent *  event)
protectedvirtual

Definition at line 585 of file kdatetimeedit.cpp.

void KDateTimeEdit::focusOutEvent ( QFocusEvent *  event)
protectedvirtual

Definition at line 590 of file kdatetimeedit.cpp.

bool KDateTimeEdit::isNull ( ) const

Return if the current user input is null.

See also
isValid()
Returns
if the current user input is null

Definition at line 323 of file kdatetimeedit.cpp.

bool KDateTimeEdit::isNullDate ( ) const

Return if the current user input date is null.

See also
isValidDate()
Returns
if the current user input date is null

Definition at line 333 of file kdatetimeedit.cpp.

bool KDateTimeEdit::isNullTime ( ) const

Return if the current user input time is null.

See also
isValidTime()
Returns
if the current user input time is null

Definition at line 343 of file kdatetimeedit.cpp.

bool KDateTimeEdit::isValid ( ) const

Return if the current user input is valid.

If the user input is null then it is not valid

See also
isNull()
Returns
if the current user input is valid

Definition at line 316 of file kdatetimeedit.cpp.

bool KDateTimeEdit::isValidDate ( ) const

Return if the current user input date is valid.

If the user input date is null then it is not valid

See also
isNullDate()
Returns
if the current user input date is valid

Definition at line 328 of file kdatetimeedit.cpp.

bool KDateTimeEdit::isValidTime ( ) const

Return if the current user input time is valid.

If the user input time is null then it is not valid

See also
isNullTime()
Returns
if the current user input time is valid

Definition at line 338 of file kdatetimeedit.cpp.

KDateTime KDateTimeEdit::maximumDateTime ( ) const

Return the current maximum date and time.

Returns
the current maximum date and time

Definition at line 468 of file kdatetimeedit.cpp.

KDateTime KDateTimeEdit::minimumDateTime ( ) const

Return the current minimum date and time.

Returns
the current minimum date and time

Definition at line 453 of file kdatetimeedit.cpp.

Options KDateTimeEdit::options ( ) const

Return the currently set widget options.

Returns
the currently set widget options
void KDateTimeEdit::resetDateTimeRange ( )
slot

Reset the minimum and maximum date and time to the default.

Definition at line 497 of file kdatetimeedit.cpp.

void KDateTimeEdit::resetMaximumDateTime ( )
slot

Reset the minimum date and time to the default.

Definition at line 473 of file kdatetimeedit.cpp.

void KDateTimeEdit::resetMinimumDateTime ( )
slot

Reset the minimum date and time to the default.

Definition at line 458 of file kdatetimeedit.cpp.

void KDateTimeEdit::resizeEvent ( QResizeEvent *  event)
protectedvirtual

Definition at line 596 of file kdatetimeedit.cpp.

void KDateTimeEdit::setCalendar ( KCalendarSystem *  calendar = 0)
slot

Changes the calendar system to use.

Can use its own local locale if set.

You retain ownership of the calendar object, it will not be destroyed with the widget.

Parameters
calendarthe calendar system object to use, defaults to global

Definition at line 410 of file kdatetimeedit.cpp.

void KDateTimeEdit::setCalendarSystem ( KLocale::CalendarSystem  calendarSystem)
slot

Set the Calendar System used for this widget.

Uses the global locale.

See also
KLocale::CalendarSystem
calendarSystem()
Parameters
calendarSystemthe Calendar System to use

Definition at line 393 of file kdatetimeedit.cpp.

void KDateTimeEdit::setCalendarSystemsList ( QList< KLocale::CalendarSystem >  calendars)
slot

Set the list of Calendar Systems to display.

Parameters
calendarsthe list of calendar systems to display

Definition at line 502 of file kdatetimeedit.cpp.

void KDateTimeEdit::setDate ( const QDate &  date)
slot

Set the currently selected date.

Parameters
datethe new date

Definition at line 378 of file kdatetimeedit.cpp.

void KDateTimeEdit::setDateDisplayFormat ( KLocale::DateFormat  format)
slot

Sets the date format to display.

By default is the Short Date format.

Parameters
formatthe date format to use

Definition at line 515 of file kdatetimeedit.cpp.

void KDateTimeEdit::setDateMap ( QMap< QDate, QString >  dateMap)
slot

Set the list of dates able to be selected from the drop-down and the string form to display for those dates, e.g.

"2010-01-01" and "Yesterday".

Any invalid or duplicate dates will be used, the list will NOT be sorted, and the minimum and maximum date will not be affected.

The dateMap is keyed by the date to be listed and the value is the string to be displayed. If you want the date to be displayed in the default date format then the string should be null. If you want a separator to be displayed then set the string to "seperator".

See also
dateMap()
Parameters
dateMapthe map of dates able to be selected

Definition at line 525 of file kdatetimeedit.cpp.

void KDateTimeEdit::setDateTime ( const KDateTime &  dateTime)
slot

Set the currently selected date, time and time spec.

Parameters
dateTimethe new date, time and time spec

Definition at line 361 of file kdatetimeedit.cpp.

void KDateTimeEdit::setDateTimeRange ( const KDateTime &  minDateTime,
const KDateTime &  maxDateTime,
const QString &  minWarnMsg = QString(),
const QString &  maxWarnMsg = QString() 
)
slot

Set the minimum and maximum date and time range.

To enable range checking provide two valid dates. To disable range checking provide two invalid dates, or call clearDateRange;

Parameters
minDateTimethe minimum date and time
maxDateTimethe maximum date and time
minWarnMsgthe minimum warning message
maxWarnMsgthe maximum warning message

Definition at line 478 of file kdatetimeedit.cpp.

void KDateTimeEdit::setMaximumDateTime ( const KDateTime &  maxDateTime,
const QString &  maxWarnMsg = QString() 
)
slot

Set the maximum allowed date.

If the date is invalid, or less than current minimum, then the maximum will not be set.

See also
setMinimumDateTime()
setDateRange()
Parameters
maxDatethe maximum date
maxWarnMsgthe maximum warning message

Definition at line 463 of file kdatetimeedit.cpp.

void KDateTimeEdit::setMinimumDateTime ( const KDateTime &  minDateTime,
const QString &  minWarnMsg = QString() 
)
slot

Set the minimum allowed date.

If the date is invalid, or more than current maximum, then the minimum will not be set.

See also
setMaximumDateTime()
setDateRange()
Parameters
maxDatethe minimum date
maxWarnMsgthe minimum warning message

Definition at line 448 of file kdatetimeedit.cpp.

void KDateTimeEdit::setOptions ( Options  options)
slot

Set the new widget options.

Parameters
optionsthe new widget options

Definition at line 348 of file kdatetimeedit.cpp.

void KDateTimeEdit::setTime ( const QTime &  time)
slot

Set the currently selected time.

Parameters
timethe new time

Definition at line 416 of file kdatetimeedit.cpp.

void KDateTimeEdit::setTimeDisplayFormat ( KLocale::TimeFormatOptions  formatOptions)
slot

Sets the time format to display.

By default is the Short Time format.

Parameters
formatthe time format to use

Definition at line 535 of file kdatetimeedit.cpp.

void KDateTimeEdit::setTimeList ( QList< QTime >  timeList,
const QString &  minWarnMsg = QString(),
const QString &  maxWarnMsg = QString() 
)
slot

Set the list of times able to be selected from the drop-down.

Setting the time list will override any time interval previously set via setTimeListInterval().

Any invalid or duplicate times will be ignored, and the list will be sorted.

The minimum and maximum time will automatically be set to the earliest and latest value in the list.

See also
timeList()
Parameters
timeListthe list of times able to be selected
minWarnMsgthe minimum warning message
maxWarnMsgthe maximum warning message

Definition at line 555 of file kdatetimeedit.cpp.

void KDateTimeEdit::setTimeListInterval ( int  minutes)
slot

Set the interval between times able to be selected from the drop-down.

The combo drop-down will be populated with times every

Parameters
minutesapart, starting from the minimumTime() and ending at maximumTime().

If the ForceInterval option is set then any time manually typed into the combo line edit will be forced to the nearest interval.

This interval must be an exact divisor of the valid time range hours. For example with the default 24 hour range interval must divide 1440 minutes exactly, meaning 1, 6 and 90 are valid but 7, 31 and 91 are not.

Setting the time list interval will override any time list previously set via setTimeList().

See also
timeListInterval()
Parameters
minutesthe time list interval to display

Definition at line 545 of file kdatetimeedit.cpp.

void KDateTimeEdit::setTimeSpec ( const KDateTime::Spec &  spec)
slot

Set the current time spec.

Parameters
specthe new spec

Definition at line 431 of file kdatetimeedit.cpp.

void KDateTimeEdit::setTimeZones ( const KTimeZones::ZoneMap &  zones)
slot

Set the time zones able to be selected.

Parameters
zonesthe time zones to display

Definition at line 567 of file kdatetimeedit.cpp.

QTime KDateTimeEdit::time ( ) const

Return the currently selected time.

Returns
the currently selected time
void KDateTimeEdit::timeChanged ( const QTime &  time)
signal

Signal if the time has been changed either manually by the user or programatically.

The returned time may be invalid.

Parameters
timethe new time
KLocale::TimeFormatOptions KDateTimeEdit::timeDisplayFormat ( ) const

Return the currently set time format.

By default this is the Short Time

Returns
the currently set time format

Definition at line 540 of file kdatetimeedit.cpp.

void KDateTimeEdit::timeEdited ( const QTime &  time)
signal

Signal if the time is being manually edited by the user.

The returned time may be invalid.

Parameters
timethe new time
void KDateTimeEdit::timeEntered ( const QTime &  time)
signal

Signal if the time has been manually entered by the user.

The returned time may be invalid.

Parameters
timethe new time
QList< QTime > KDateTimeEdit::timeList ( ) const

Return the list of times able to be selected in the drop-down.

See also
setTimeList()
timeListInterval()
setTimeListInterval()
Returns
the select time list

Definition at line 562 of file kdatetimeedit.cpp.

int KDateTimeEdit::timeListInterval ( ) const

Return the time list interval able to be selected.

Returns
the select time intervals in minutes
KDateTime::Spec KDateTimeEdit::timeSpec ( ) const

Return the currently selected time spec.

Returns
the currently selected time spec

Definition at line 311 of file kdatetimeedit.cpp.

void KDateTimeEdit::timeSpecChanged ( const KDateTime::Spec &  spec)
signal

Signal if the time spec has been changed either manually by the user or programatically.

Parameters
timeSpecthe new time spec
void KDateTimeEdit::timeSpecEntered ( const KDateTime::Spec &  spec)
signal

Signal if the time spec has been changed manually by the user.

Parameters
timeSpecthe new time spec
KTimeZones::ZoneMap KDateTimeEdit::timeZones ( ) const

Return the list of time zones able to be selected.

Parameters
zonesthe time zones to display

Definition at line 575 of file kdatetimeedit.cpp.

Property Documentation

QDate KDateTimeEdit::date
readwrite

Definition at line 37 of file kdatetimeedit.h.

KDateTimeEdit::Options KDateTimeEdit::options
readwrite

Definition at line 40 of file kdatetimeedit.h.

QTime KDateTimeEdit::time
readwrite

Definition at line 38 of file kdatetimeedit.h.

int KDateTimeEdit::timeListInterval
readwrite

Definition at line 39 of file kdatetimeedit.h.


The documentation for this class was generated from the following files:
  • kdatetimeedit.h
  • kdatetimeedit.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:17 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal