• 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::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::dateTimeEdited
void dateTimeEdited(const KDateTime &dateTime)
Signal if the date or time is being manually edited by the user.
KDateTimeEdit::Option
Option
Options provided by the widget.
Definition: kdatetimeedit.h:50
KDateTimeEdit::dateChanged
void dateChanged(const QDate &date)
Signal if the date has been changed either manually by the user or programatically.
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::timeSpecChanged
void timeSpecChanged(const KDateTime::Spec &spec)
Signal if the time spec has been changed either manually by the user or programatically.
KDateTimeEdit::calendarEntered
void calendarEntered(KLocale::CalendarSystem calendarSystem)
Signal if the Calendar System has been manually entered by the user.
KDateTimeEdit::timeChanged
void timeChanged(const QTime &time)
Signal if the time has been changed either manually by the user or programatically.
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::dateEntered
void dateEntered(const QDate &date)
Signal if the date has been manually entered by the user.
KDateTime::Spec
KDateTime
KLocale::DateFormat
DateFormat
KLocale::CalendarSystem
CalendarSystem
QList
QMap
QObject
QWidget
kdatetime.h
kdeui_export.h
klocale.h
Option
Option
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 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-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