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

KDEUI

  • kdeui
  • widgets
kdatetimeedit.h
Go to the documentation of this file.
1/*
2 Copyright 2011 John Layt <john@layt.net>
3
4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Library General Public
6 License as published by the Free Software Foundation; either
7 version 2 of the License, or (at your option) any later version.
8
9 This library is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 Library General Public License for more details.
13
14 You should have received a copy of the GNU Library General Public License
15 along with this library; see the file COPYING.LIB. If not, write to
16 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
17 Boston, MA 02110-1301, USA.
18*/
19
20#ifndef KDATETIMEEDIT_H
21#define KDATETIMEEDIT_H
22
23#include <kdeui_export.h>
24
25#include <QtGui/QWidget>
26
27#include "klocale.h"
28#include "kdatetime.h"
29
30class KDateTimeEditPrivate;
31class KCalendarSystem;
32
33class KDEUI_EXPORT KDateTimeEdit : public QWidget
34{
35 Q_OBJECT
36
37 Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged USER true)
38 Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged USER true)
39 Q_PROPERTY(int timeListInterval READ timeListInterval WRITE setTimeListInterval)
40 Q_PROPERTY(Options options READ options WRITE setOptions)
41 Q_FLAGS(Options)
42
43public:
44
50 enum Option {
51 ShowCalendar = 0x00001,
52 ShowDate = 0x00002,
53 ShowTime = 0x00004,
54 ShowTimeSpec = 0x00008,
55 //EditCalendar = 0x00010, /**< Allow the user to manually edit the calendar */
56 EditDate = 0x00020,
57 EditTime = 0x00040,
58 //EditTimeSpec = 0x00080, /**< Allow the user to manually edit the time spec */
59 SelectCalendar = 0x00100,
60 SelectDate = 0x00200,
61 SelectTime = 0x00400,
62 SelectTimeSpec = 0x00800,
63 DatePicker = 0x01000,
64 DateKeywords = 0x02000,
65 ForceTime = 0x04000,
66 WarnOnInvalid = 0x08000
67 };
68 Q_DECLARE_FLAGS(Options, Option)
69
70
73 explicit KDateTimeEdit(QWidget *parent = 0);
74
78 virtual ~KDateTimeEdit();
79
85 Options options() const;
86
92 KDateTime dateTime() const;
93
101 KLocale::CalendarSystem calendarSystem() const;
102
116 const KCalendarSystem *calendar() const;
117
123 QDate date() const;
124
130 QTime time() const;
131
137 KDateTime::Spec timeSpec() const;
138
144 QList<KLocale::CalendarSystem> calendarSystemsList() const;
145
151 KDateTime minimumDateTime() const;
152
158 KDateTime maximumDateTime() const;
159
167 KLocale::DateFormat dateDisplayFormat() const;
168
176 QMap<QDate, QString> dateMap() const;
177
185 KLocale::TimeFormatOptions timeDisplayFormat() const;
186
192 int timeListInterval() const;
193
202 QList<QTime> timeList() const;
203
209 KTimeZones::ZoneMap timeZones() const;
210
219 bool isValid() const;
220
227 bool isNull() const;
228
237 bool isValidDate() const;
238
245 bool isNullDate() const;
254 bool isValidTime() const;
255
262 bool isNullTime() const;
263
264Q_SIGNALS:
265
273 void dateTimeEntered(const KDateTime &dateTime);
274
283 void dateTimeChanged(const KDateTime &dateTime);
284
292 void dateTimeEdited(const KDateTime &dateTime);
293
299 void calendarEntered(KLocale::CalendarSystem calendarSystem);
300
307 void calendarChanged(KLocale::CalendarSystem calendarSystem);
308
316 void dateEntered(const QDate &date);
317
326 void dateChanged(const QDate &date);
327
335 void dateEdited(const QDate &date);
336
344 void timeEntered(const QTime &time);
345
354 void timeChanged(const QTime &time);
355
363 void timeEdited(const QTime &time);
364
370 void timeSpecEntered(const KDateTime::Spec &spec);
371
378 void timeSpecChanged(const KDateTime::Spec &spec);
379
380public Q_SLOTS:
381
387 void setOptions(Options options);
388
394 void setDateTime(const KDateTime &dateTime);
395
403 void setCalendarSystem(KLocale::CalendarSystem calendarSystem);
404
412 void setCalendar(KCalendarSystem *calendar = 0);
413
419 void setDate(const QDate &date);
420
426 void setTime(const QTime &time);
427
433 void setTimeSpec(const KDateTime::Spec &spec);
434
447 void setDateTimeRange(const KDateTime &minDateTime,
448 const KDateTime &maxDateTime,
449 const QString &minWarnMsg = QString(),
450 const QString &maxWarnMsg = QString());
451
455 void resetDateTimeRange();
456
468 void setMinimumDateTime(const KDateTime &minDateTime, const QString &minWarnMsg = QString());
469
473 void resetMinimumDateTime();
474
486 void setMaximumDateTime(const KDateTime &maxDateTime, const QString &maxWarnMsg = QString());
487
491 void resetMaximumDateTime();
492
500 void setDateDisplayFormat(KLocale::DateFormat format);
501
507 void setCalendarSystemsList(QList<KLocale::CalendarSystem> calendars);
508
524 void setDateMap(QMap<QDate, QString> dateMap);
525
533 void setTimeDisplayFormat(KLocale::TimeFormatOptions formatOptions);
534
554 void setTimeListInterval(int minutes);
555
573 void setTimeList(QList<QTime> timeList,
574 const QString &minWarnMsg = QString(),
575 const QString &maxWarnMsg = QString());
576
582 void setTimeZones(const KTimeZones::ZoneMap &zones);
583
584protected:
585
586 virtual bool eventFilter(QObject *object, QEvent *event);
587 virtual void focusInEvent(QFocusEvent *event);
588 virtual void focusOutEvent(QFocusEvent *event);
589 virtual void resizeEvent(QResizeEvent *event);
590
599 virtual void assignDateTime(const KDateTime &dateTime);
600
609 virtual void assignDate(const QDate &date);
610
619 void assignCalendarSystem(KLocale::CalendarSystem calendarSystem);
620
629 virtual void assignTime(const QTime &time);
630
639 void assignTimeSpec(const KDateTime::Spec &spec);
640
641private:
642
643 friend class KDateTimeEditPrivate;
644 KDateTimeEditPrivate *const d;
645
646 Q_PRIVATE_SLOT(d, void selectCalendar(int))
647 Q_PRIVATE_SLOT(d, void enterCalendar(KLocale::CalendarSystem))
648 Q_PRIVATE_SLOT(d, void selectTimeZone(int))
649 Q_PRIVATE_SLOT(d, void enterTimeZone(const QString&))
650};
651
652Q_DECLARE_OPERATORS_FOR_FLAGS(KDateTimeEdit::Options)
653
654#endif // KDATETIMEEDIT_H
KCalendarSystem
KDateTimeEdit
Definition kdatetimeedit.h:34
KDateTimeEdit::minimumDateTime
KDateTime minimumDateTime() const
Return the current minimum date and time.
Definition kdatetimeedit.cpp:457
KDateTimeEdit::KDateTimeEdit
KDateTimeEdit(QWidget *parent=0)
Create a new KDateTimeEdit widget.
Definition kdatetimeedit.cpp:264
KDateTimeEdit::eventFilter
virtual bool eventFilter(QObject *object, QEvent *event)
Definition kdatetimeedit.cpp:584
KDateTimeEdit::resetMinimumDateTime
void resetMinimumDateTime()
Reset the minimum date and time to the default.
Definition kdatetimeedit.cpp:462
KDateTimeEdit::setTimeSpec
void setTimeSpec(const KDateTime::Spec &spec)
Set the current time spec.
Definition kdatetimeedit.cpp:435
KDateTimeEdit::setDateMap
void setDateMap(QMap< QDate, QString > dateMap)
Set the list of dates able to be selected from the drop-down and the string form to display for those...
Definition kdatetimeedit.cpp:529
KDateTimeEdit::setCalendar
void setCalendar(KCalendarSystem *calendar=0)
Changes the calendar system to use.
Definition kdatetimeedit.cpp:414
KDateTimeEdit::setDate
void setDate(const QDate &date)
Set the currently selected date.
Definition kdatetimeedit.cpp:382
KDateTimeEdit::calendarSystem
KLocale::CalendarSystem calendarSystem() const
Returns the Calendar System type used by the widget.
Definition kdatetimeedit.cpp:300
KDateTimeEdit::assignCalendarSystem
void assignCalendarSystem(KLocale::CalendarSystem calendarSystem)
Assign the calendar system for the widget.
Definition kdatetimeedit.cpp:408
KDateTimeEdit::resizeEvent
virtual void resizeEvent(QResizeEvent *event)
Definition kdatetimeedit.cpp:600
KDateTimeEdit::dateEdited
void dateEdited(const QDate &date)
Signal if the date is being manually edited by the user.
KDateTimeEdit::dateTimeChanged
void dateTimeChanged(const KDateTime &dateTime)
Signal if the date or time has been changed either manually by the user or programatically.
KDateTimeEdit::setTimeZones
void setTimeZones(const KTimeZones::ZoneMap &zones)
Set the time zones able to be selected.
Definition kdatetimeedit.cpp:571
KDateTimeEdit::isNullTime
bool isNullTime() const
Return if the current user input time is null.
Definition kdatetimeedit.cpp:347
KDateTimeEdit::dateTimeEdited
void dateTimeEdited(const KDateTime &dateTime)
Signal if the date or time is being manually edited by the user.
KDateTimeEdit::assignDateTime
virtual void assignDateTime(const KDateTime &dateTime)
Assign the date, time and time spec for the widget.
Definition kdatetimeedit.cpp:375
KDateTimeEdit::resetDateTimeRange
void resetDateTimeRange()
Reset the minimum and maximum date and time to the default.
Definition kdatetimeedit.cpp:501
KDateTimeEdit::setMinimumDateTime
void setMinimumDateTime(const KDateTime &minDateTime, const QString &minWarnMsg=QString())
Set the minimum allowed date.
Definition kdatetimeedit.cpp:452
KDateTimeEdit::Option
Option
Options provided by the widget.
Definition kdatetimeedit.h:50
KDateTimeEdit::ForceTime
@ ForceTime
The entered time can only be a selected time.
Definition kdatetimeedit.h:65
KDateTimeEdit::WarnOnInvalid
@ WarnOnInvalid
Show a warning on focus out if the date or time is invalid.
Definition kdatetimeedit.h:66
KDateTimeEdit::ShowCalendar
@ ShowCalendar
If the Calendar System edit is displayed.
Definition kdatetimeedit.h:51
KDateTimeEdit::EditTime
@ EditTime
Allow the user to manually edit the time.
Definition kdatetimeedit.h:57
KDateTimeEdit::DatePicker
@ DatePicker
Show a date picker.
Definition kdatetimeedit.h:63
KDateTimeEdit::ShowTime
@ ShowTime
If the Time is displayed.
Definition kdatetimeedit.h:53
KDateTimeEdit::ShowDate
@ ShowDate
If the Date is displayed.
Definition kdatetimeedit.h:52
KDateTimeEdit::SelectTimeSpec
@ SelectTimeSpec
Allow the user to select a time spec.
Definition kdatetimeedit.h:62
KDateTimeEdit::DateKeywords
@ DateKeywords
Show date keywords.
Definition kdatetimeedit.h:64
KDateTimeEdit::EditDate
@ EditDate
Allow the user to manually edit the date.
Definition kdatetimeedit.h:56
KDateTimeEdit::SelectDate
@ SelectDate
Allow the user to select a date.
Definition kdatetimeedit.h:60
KDateTimeEdit::ShowTimeSpec
@ ShowTimeSpec
If the Time Spec is displayed.
Definition kdatetimeedit.h:54
KDateTimeEdit::SelectTime
@ SelectTime
Allow the user to select a time.
Definition kdatetimeedit.h:61
KDateTimeEdit::SelectCalendar
@ SelectCalendar
Allow the user to select a calendar.
Definition kdatetimeedit.h:59
KDateTimeEdit::isValid
bool isValid() const
Return if the current user input is valid.
Definition kdatetimeedit.cpp:320
KDateTimeEdit::dateChanged
void dateChanged(const QDate &date)
Signal if the date has been changed either manually by the user or programatically.
KDateTimeEdit::maximumDateTime
KDateTime maximumDateTime() const
Return the current maximum date and time.
Definition kdatetimeedit.cpp:472
KDateTimeEdit::timeEdited
void timeEdited(const QTime &time)
Signal if the time is being manually edited by the user.
KDateTimeEdit::calendar
const KCalendarSystem * calendar() const
Returns a pointer to the Calendar System object used by this widget.
KDateTimeEdit::calendarChanged
void calendarChanged(KLocale::CalendarSystem calendarSystem)
Signal if the Calendar System has been changed either manually by the user or programatically.
KDateTimeEdit::timeSpecEntered
void timeSpecEntered(const KDateTime::Spec &spec)
Signal if the time spec has been changed manually by the user.
KDateTimeEdit::setMaximumDateTime
void setMaximumDateTime(const KDateTime &maxDateTime, const QString &maxWarnMsg=QString())
Set the maximum allowed date.
Definition kdatetimeedit.cpp:467
KDateTimeEdit::setTime
void setTime(const QTime &time)
Set the currently selected time.
Definition kdatetimeedit.cpp:420
KDateTimeEdit::assignTime
virtual void assignTime(const QTime &time)
Assign the time for the widget.
Definition kdatetimeedit.cpp:429
KDateTimeEdit::timeList
QList< QTime > timeList() const
Return the list of times able to be selected in the drop-down.
Definition kdatetimeedit.cpp:566
KDateTimeEdit::isNull
bool isNull() const
Return if the current user input is null.
Definition kdatetimeedit.cpp:327
KDateTimeEdit::timeSpecChanged
void timeSpecChanged(const KDateTime::Spec &spec)
Signal if the time spec has been changed either manually by the user or programatically.
KDateTimeEdit::timeSpec
KDateTime::Spec timeSpec() const
Return the currently selected time spec.
Definition kdatetimeedit.cpp:315
KDateTimeEdit::time
QTime time
Definition kdatetimeedit.h:38
KDateTimeEdit::setDateDisplayFormat
void setDateDisplayFormat(KLocale::DateFormat format)
Sets the date format to display.
Definition kdatetimeedit.cpp:519
KDateTimeEdit::resetMaximumDateTime
void resetMaximumDateTime()
Reset the minimum date and time to the default.
Definition kdatetimeedit.cpp:477
KDateTimeEdit::calendarEntered
void calendarEntered(KLocale::CalendarSystem calendarSystem)
Signal if the Calendar System has been manually entered by the user.
KDateTimeEdit::timeDisplayFormat
KLocale::TimeFormatOptions timeDisplayFormat() const
Return the currently set time format.
Definition kdatetimeedit.cpp:544
KDateTimeEdit::setCalendarSystem
void setCalendarSystem(KLocale::CalendarSystem calendarSystem)
Set the Calendar System used for this widget.
Definition kdatetimeedit.cpp:397
KDateTimeEdit::KDateTimeEditPrivate
friend class KDateTimeEditPrivate
Definition kdatetimeedit.h:643
KDateTimeEdit::setCalendarSystemsList
void setCalendarSystemsList(QList< KLocale::CalendarSystem > calendars)
Set the list of Calendar Systems to display.
Definition kdatetimeedit.cpp:506
KDateTimeEdit::setTimeList
void setTimeList(QList< QTime > timeList, const QString &minWarnMsg=QString(), const QString &maxWarnMsg=QString())
Set the list of times able to be selected from the drop-down.
Definition kdatetimeedit.cpp:559
KDateTimeEdit::timeChanged
void timeChanged(const QTime &time)
Signal if the time has been changed either manually by the user or programatically.
KDateTimeEdit::setDateTime
void setDateTime(const KDateTime &dateTime)
Set the currently selected date, time and time spec.
Definition kdatetimeedit.cpp:365
KDateTimeEdit::setDateTimeRange
void setDateTimeRange(const KDateTime &minDateTime, const KDateTime &maxDateTime, const QString &minWarnMsg=QString(), const QString &maxWarnMsg=QString())
Set the minimum and maximum date and time range.
Definition kdatetimeedit.cpp:482
KDateTimeEdit::date
QDate date
Definition kdatetimeedit.h:37
KDateTimeEdit::timeEntered
void timeEntered(const QTime &time)
Signal if the time has been manually entered by the user.
KDateTimeEdit::dateTimeEntered
void dateTimeEntered(const KDateTime &dateTime)
Signal if the date or time has been manually entered by the user.
KDateTimeEdit::focusOutEvent
virtual void focusOutEvent(QFocusEvent *event)
Definition kdatetimeedit.cpp:594
KDateTimeEdit::assignDate
virtual void assignDate(const QDate &date)
Assign the date for the widget.
Definition kdatetimeedit.cpp:391
KDateTimeEdit::options
Options options
Definition kdatetimeedit.h:40
KDateTimeEdit::setTimeDisplayFormat
void setTimeDisplayFormat(KLocale::TimeFormatOptions formatOptions)
Sets the time format to display.
Definition kdatetimeedit.cpp:539
KDateTimeEdit::timeListInterval
int timeListInterval
Definition kdatetimeedit.h:39
KDateTimeEdit::dateDisplayFormat
KLocale::DateFormat dateDisplayFormat() const
Return the currently set date display format.
Definition kdatetimeedit.cpp:524
KDateTimeEdit::setOptions
void setOptions(Options options)
Set the new widget options.
Definition kdatetimeedit.cpp:352
KDateTimeEdit::timeZones
KTimeZones::ZoneMap timeZones() const
Return the list of time zones able to be selected.
Definition kdatetimeedit.cpp:579
KDateTimeEdit::dateMap
QMap< QDate, QString > dateMap() const
Return the map of dates listed in the drop-down and their displayed string forms.
Definition kdatetimeedit.cpp:534
KDateTimeEdit::focusInEvent
virtual void focusInEvent(QFocusEvent *event)
Definition kdatetimeedit.cpp:589
KDateTimeEdit::setTimeListInterval
void setTimeListInterval(int minutes)
Set the interval between times able to be selected from the drop-down.
Definition kdatetimeedit.cpp:549
KDateTimeEdit::calendarSystemsList
QList< KLocale::CalendarSystem > calendarSystemsList() const
Returns the list of Calendar Systems displayed.
Definition kdatetimeedit.cpp:514
KDateTimeEdit::dateTime
KDateTime dateTime() const
Return the currently selected date, time and time spec.
Definition kdatetimeedit.cpp:295
KDateTimeEdit::isValidDate
bool isValidDate() const
Return if the current user input date is valid.
Definition kdatetimeedit.cpp:332
KDateTimeEdit::assignTimeSpec
void assignTimeSpec(const KDateTime::Spec &spec)
Assign the time spec for the widget.
Definition kdatetimeedit.cpp:446
KDateTimeEdit::dateEntered
void dateEntered(const QDate &date)
Signal if the date has been manually entered by the user.
KDateTimeEdit::isNullDate
bool isNullDate() const
Return if the current user input date is null.
Definition kdatetimeedit.cpp:337
KDateTimeEdit::isValidTime
bool isValidTime() const
Return if the current user input time is valid.
Definition kdatetimeedit.cpp:342
KDateTime::Spec
KDateTime
KLocale::DateFormat
DateFormat
KLocale::CalendarSystem
CalendarSystem
KTimeZones::ZoneMap
QMap< QString, KTimeZone > ZoneMap
QList
QMap
QObject
QWidget
kdatetime.h
kdeui_export.h
klocale.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Fri Jan 17 2025 00:00:00 by doxygen 1.13.2 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
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 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
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
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