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

KDEUI

  • kdeui
  • widgets
kdatecombobox.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 KDATECOMBOBOX_H
21#define KDATECOMBOBOX_H
22
23#include <kdeui_export.h>
24
25#include <QtGui/QWidget>
26
27#include "kcombobox.h"
28#include "klocale.h"
29#include "kdatetime.h"
30
31class KDateComboBoxPrivate;
32class KCalendarSystem;
33
34class KDEUI_EXPORT KDateComboBox : public KComboBox
35{
36 Q_OBJECT
37
38 Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged USER true)
39 Q_PROPERTY(QDate minimumDate READ minimumDate WRITE setMinimumDate RESET resetMinimumDate)
40 Q_PROPERTY(QDate maximumDate READ maximumDate WRITE setMaximumDate RESET resetMaximumDate)
41 Q_PROPERTY(Options options READ options WRITE setOptions)
42 Q_FLAGS(Options)
43
44public:
45
51 enum Option {
52 EditDate = 0x0001,
53 SelectDate = 0x0002,
54 DatePicker = 0x0004,
55 DateKeywords = 0x0008,
56 WarnOnInvalid = 0x0010
57 };
58 Q_DECLARE_FLAGS(Options, Option)
59
60
67 explicit KDateComboBox(QWidget *parent = 0);
68
72 virtual ~KDateComboBox();
73
79 QDate date() const;
80
88 KLocale::CalendarSystem calendarSystem() const;
89
103 const KCalendarSystem *calendar() const;
104
113 bool isValid() const;
114
121 bool isNull() const;
122
128 Options options() const;
129
137 KLocale::DateFormat displayFormat() const;
138
144 QDate minimumDate() const;
145
151 QDate maximumDate() const;
152
160 QMap<QDate, QString> dateMap() const;
161
162Q_SIGNALS:
163
171 void dateEntered(const QDate &date);
172
181 void dateChanged(const QDate &date);
182
190 void dateEdited(const QDate &date);
191
192public Q_SLOTS:
193
202 void setDate(const QDate &date);
203
211 void setCalendarSystem(KLocale::CalendarSystem calendarSystem);
212
220 void setCalendar(KCalendarSystem *calendar = 0);
221
227 void setOptions(Options options);
228
236 void setDisplayFormat(KLocale::DateFormat format);
237
249 void setDateRange(const QDate &minDate,
250 const QDate &maxDate,
251 const QString &minWarnMsg = QString(),
252 const QString &maxWarnMsg = QString());
253
258 void resetDateRange();
259
273 void setMinimumDate(const QDate &minTime, const QString &minWarnMsg = QString());
274
278 void resetMinimumDate();
279
293 void setMaximumDate(const QDate &maxDate, const QString &maxWarnMsg = QString());
294
298 void resetMaximumDate();
299
315 void setDateMap(QMap<QDate, QString> dateMap);
316
317protected:
318
319 virtual bool eventFilter(QObject *object, QEvent *event);
320 virtual void showPopup();
321 virtual void hidePopup();
322 virtual void mousePressEvent(QMouseEvent *event);
323 virtual void wheelEvent(QWheelEvent *event);
324 virtual void keyPressEvent(QKeyEvent *event);
325 virtual void focusInEvent(QFocusEvent *event);
326 virtual void focusOutEvent(QFocusEvent *event);
327 virtual void resizeEvent(QResizeEvent *event);
328
336 virtual void assignDate(const QDate &date);
337
345 virtual void assignCalendarSystem(KLocale::CalendarSystem calendarSystem);
346
347private:
348
349 friend class KDateComboBoxPrivate;
350 KDateComboBoxPrivate *const d;
351
352 Q_PRIVATE_SLOT(d, void clickDate())
353 Q_PRIVATE_SLOT(d, void selectDate(QAction*))
354 Q_PRIVATE_SLOT(d, void editDate(const QString&))
355 Q_PRIVATE_SLOT(d, void enterDate(const QDate&))
356 Q_PRIVATE_SLOT(d, void parseDate())
357
358};
359
360Q_DECLARE_OPERATORS_FOR_FLAGS(KDateComboBox::Options)
361
362#endif // KDATECOMBOBOX_H
KCalendarSystem
KComboBox::eventFilter
virtual bool eventFilter(QObject *, QEvent *)
Re-implemented for internal reasons.
Definition kcombobox.cpp:183
KComboBox::KComboBox
KComboBox(QWidget *parent=0)
Constructs a read-only or rather select-only combo box with a parent object and a name.
Definition kcombobox.cpp:57
KComboBox::wheelEvent
virtual void wheelEvent(QWheelEvent *ev)
Definition kcombobox.cpp:260
KDateComboBox
Definition kdatecombobox.h:35
KDateComboBox::showPopup
virtual void showPopup()
Definition kdatecombobox.cpp:499
KDateComboBox::setOptions
void setOptions(Options options)
Set the new widget options.
Definition kdatecombobox.cpp:371
KDateComboBox::setMinimumDate
void setMinimumDate(const QDate &minTime, const QString &minWarnMsg=QString())
Set the minimum allowed date.
Definition kdatecombobox.cpp:385
KDateComboBox::setCalendar
void setCalendar(KCalendarSystem *calendar=0)
Changes the calendar system to use.
Definition kdatecombobox.cpp:348
KDateComboBox::dateEdited
void dateEdited(const QDate &date)
Signal if the date is being manually edited by the user.
KDateComboBox::KDateComboBoxPrivate
friend class KDateComboBoxPrivate
Definition kdatecombobox.h:349
KDateComboBox::keyPressEvent
virtual void keyPressEvent(QKeyEvent *event)
Definition kdatecombobox.cpp:467
KDateComboBox::setDisplayFormat
void setDisplayFormat(KLocale::DateFormat format)
Sets the date format to display.
Definition kdatecombobox.cpp:439
KDateComboBox::maximumDate
QDate maximumDate
Definition kdatecombobox.h:40
KDateComboBox::resizeEvent
virtual void resizeEvent(QResizeEvent *event)
Definition kdatecombobox.cpp:558
KDateComboBox::resetMinimumDate
void resetMinimumDate()
Reset the minimum date to the default.
Definition kdatecombobox.cpp:390
KDateComboBox::KDateComboBox
KDateComboBox(QWidget *parent=0)
Create a new KDateComboBox widget.
Definition kdatecombobox.cpp:278
KDateComboBox::calendarSystem
KLocale::CalendarSystem calendarSystem() const
Returns the Calendar System type used by the widget.
Definition kdatecombobox.cpp:326
KDateComboBox::calendar
const KCalendarSystem * calendar() const
Returns a pointer to the Calendar System object used by this widget.
Definition kdatecombobox.cpp:343
KDateComboBox::Option
Option
Options provided by the widget.
Definition kdatecombobox.h:51
KDateComboBox::SelectDate
@ SelectDate
Allow the user to select the date from a drop-down menu.
Definition kdatecombobox.h:53
KDateComboBox::DateKeywords
@ DateKeywords
Show date keywords in the drop-down.
Definition kdatecombobox.h:55
KDateComboBox::WarnOnInvalid
@ WarnOnInvalid
Show a warning on focus out if the date is invalid.
Definition kdatecombobox.h:56
KDateComboBox::EditDate
@ EditDate
Allow the user to manually edit the date in the combo line edit.
Definition kdatecombobox.h:52
KDateComboBox::DatePicker
@ DatePicker
Show a date picker in the drop-down.
Definition kdatecombobox.h:54
KDateComboBox::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 kdatecombobox.cpp:453
KDateComboBox::setDate
void setDate(const QDate &date)
Set the currently selected date.
Definition kdatecombobox.cpp:310
KDateComboBox::setMaximumDate
void setMaximumDate(const QDate &maxDate, const QString &maxWarnMsg=QString())
Set the maximum allowed date.
Definition kdatecombobox.cpp:400
KDateComboBox::resetDateRange
void resetDateRange()
Reset the minimum and maximum date to the default values.
Definition kdatecombobox.cpp:429
KDateComboBox::focusOutEvent
virtual void focusOutEvent(QFocusEvent *event)
Definition kdatecombobox.cpp:492
KDateComboBox::focusInEvent
virtual void focusInEvent(QFocusEvent *event)
Definition kdatecombobox.cpp:553
KDateComboBox::setCalendarSystem
void setCalendarSystem(KLocale::CalendarSystem calendarSystem)
Set the Calendar System used for this widget.
Definition kdatecombobox.cpp:331
KDateComboBox::dateMap
QMap< QDate, QString > dateMap() const
Return the map of dates listed in the drop-down and their displayed string forms.
Definition kdatecombobox.cpp:448
KDateComboBox::assignDate
virtual void assignDate(const QDate &date)
Assign the date for the widget.
Definition kdatecombobox.cpp:321
KDateComboBox::date
QDate date
Definition kdatecombobox.h:38
KDateComboBox::minimumDate
QDate minimumDate
Definition kdatecombobox.h:39
KDateComboBox::resetMaximumDate
void resetMaximumDate()
Reset the maximum date to the default.
Definition kdatecombobox.cpp:405
KDateComboBox::mousePressEvent
virtual void mousePressEvent(QMouseEvent *event)
Definition kdatecombobox.cpp:543
KDateComboBox::dateChanged
void dateChanged(const QDate &date)
Signal if the date has been changed either manually by the user or programatically.
KDateComboBox::assignCalendarSystem
virtual void assignCalendarSystem(KLocale::CalendarSystem calendarSystem)
Assign the calendar system for the widget.
Definition kdatecombobox.cpp:338
KDateComboBox::dateEntered
void dateEntered(const QDate &date)
Signal if the date has been manually entered or selected by the user.
KDateComboBox::options
Options options
Definition kdatecombobox.h:41
KDateComboBox::hidePopup
virtual void hidePopup()
Definition kdatecombobox.cpp:538
KDateComboBox::setDateRange
void setDateRange(const QDate &minDate, const QDate &maxDate, const QString &minWarnMsg=QString(), const QString &maxWarnMsg=QString())
Set the valid date range to be applied by isValid().
Definition kdatecombobox.cpp:410
KLocale::DateFormat
DateFormat
KLocale::CalendarSystem
CalendarSystem
QAction
QMap
QObject
QWidget
kcombobox.h
kdatetime.h
kdeui_export.h
klocale.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2025 The KDE developers.
Generated on Tue Mar 25 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