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

KDEUI

kdatecombobox.h
Go to the documentation of this file.
00001 /*
00002     Copyright 2011 John Layt <john@layt.net>
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public License
00015     along with this library; see the file COPYING.LIB.  If not, write to
00016     the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00017     Boston, MA 02110-1301, USA.
00018 */
00019 
00020 #ifndef KDATECOMBOBOX_H
00021 #define KDATECOMBOBOX_H
00022 
00023 #include <kdeui_export.h>
00024 
00025 #include <QtGui/QWidget>
00026 
00027 #include "kcombobox.h"
00028 #include "klocale.h"
00029 #include "kdatetime.h"
00030 
00031 class KDateComboBoxPrivate;
00032 class KCalendarSystem;
00033 
00034 class KDEUI_EXPORT KDateComboBox : public KComboBox
00035 {
00036     Q_OBJECT
00037 
00038     Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged USER true)
00039     Q_PROPERTY(QDate minimumDate READ minimumDate WRITE setMinimumDate RESET resetMinimumDate)
00040     Q_PROPERTY(QDate maximumDate READ maximumDate WRITE setMaximumDate RESET resetMaximumDate)
00041     Q_PROPERTY(Options options READ options WRITE setOptions)
00042     Q_FLAGS(Options)
00043 
00044 public:
00045 
00051     enum Option {
00052         EditDate         = 0x0001,  
00053         SelectDate       = 0x0002,  
00054         DatePicker       = 0x0004,  
00055         DateKeywords     = 0x0008,  
00056         WarnOnInvalid    = 0x0010   
00057     };
00058     Q_DECLARE_FLAGS(Options, Option)
00059 
00060     
00067     explicit KDateComboBox(QWidget *parent = 0);
00068 
00072     virtual ~KDateComboBox();
00073 
00079     QDate date() const;
00080 
00088     KLocale::CalendarSystem calendarSystem() const;
00089 
00103     const KCalendarSystem *calendar() const;
00104 
00113     bool isValid() const;
00114 
00121     bool isNull() const;
00122 
00128     Options options() const;
00129 
00137     KLocale::DateFormat displayFormat() const;
00138 
00144     QDate minimumDate() const;
00145 
00151     QDate maximumDate() const;
00152 
00160     QMap<QDate, QString> dateMap() const;
00161 
00162 Q_SIGNALS:
00163 
00171     void dateEntered(const QDate &date);
00172 
00181     void dateChanged(const QDate &date);
00182 
00190     void dateEdited(const QDate &date);
00191 
00192 public Q_SLOTS:
00193 
00202     void setDate(const QDate &date);
00203 
00211     void setCalendarSystem(KLocale::CalendarSystem calendarSystem);
00212 
00220     void setCalendar(KCalendarSystem *calendar = 0);
00221 
00227     void setOptions(Options options);
00228 
00236     void setDisplayFormat(KLocale::DateFormat format);
00237 
00249     void setDateRange(const QDate &minDate,
00250                       const QDate &maxDate,
00251                       const QString &minWarnMsg = QString(),
00252                       const QString &maxWarnMsg = QString());
00253 
00258     void resetDateRange();
00259 
00273     void setMinimumDate(const QDate &minTime, const QString &minWarnMsg = QString());
00274 
00278     void resetMinimumDate();
00279 
00293     void setMaximumDate(const QDate &maxDate, const QString &maxWarnMsg = QString());
00294 
00298     void resetMaximumDate();
00299 
00315     void setDateMap(QMap<QDate, QString> dateMap);
00316 
00317 protected:
00318 
00319     virtual bool eventFilter(QObject *object, QEvent *event);
00320     virtual void showPopup();
00321     virtual void hidePopup();
00322     virtual void mousePressEvent(QMouseEvent *event);
00323     virtual void wheelEvent(QWheelEvent *event);
00324     virtual void keyPressEvent(QKeyEvent *event);
00325     virtual void focusInEvent(QFocusEvent *event);
00326     virtual void focusOutEvent(QFocusEvent *event);
00327     virtual void resizeEvent(QResizeEvent *event);
00328 
00336     virtual void assignDate(const QDate &date);
00337 
00345     virtual void assignCalendarSystem(KLocale::CalendarSystem calendarSystem);
00346 
00347 private:
00348 
00349     friend class KDateComboBoxPrivate;
00350     KDateComboBoxPrivate *const d;
00351 
00352     Q_PRIVATE_SLOT(d, void clickDate())
00353     Q_PRIVATE_SLOT(d, void selectDate(QAction*))
00354     Q_PRIVATE_SLOT(d, void editDate(const QString&))
00355     Q_PRIVATE_SLOT(d, void enterDate(const QDate&))
00356     Q_PRIVATE_SLOT(d, void parseDate())
00357 
00358 };
00359 
00360 Q_DECLARE_OPERATORS_FOR_FLAGS(KDateComboBox::Options)
00361 
00362 #endif // KDATECOMBOBOX_H

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

Skip menu "kdelibs"
  • 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
Generated for kdelibs by doxygen 1.7.5
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal