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

KDEUI

ktimecombobox.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 KTIMECOMBOBOX_H
00021 #define KTIMECOMBOBOX_H
00022 
00023 #include <kdeui_export.h>
00024 
00025 #include <QtGui/QWidget>
00026 
00027 #include "kcombobox.h"
00028 #include "klocale.h"
00029 
00030 class KTimeComboBoxPrivate;
00031 
00032 class KDEUI_EXPORT KTimeComboBox : public KComboBox
00033 {
00034     Q_OBJECT
00035 
00036     Q_PROPERTY(QTime time READ time WRITE setTime NOTIFY timeChanged USER true)
00037     Q_PROPERTY(QTime minimumTime READ minimumTime WRITE setMinimumTime RESET resetMinimumTime)
00038     Q_PROPERTY(QTime maximumTime READ maximumTime WRITE setMaximumTime RESET resetMaximumTime)
00039     Q_PROPERTY(int timeListInterval READ timeListInterval WRITE setTimeListInterval)
00040     Q_PROPERTY(Options options READ options WRITE setOptions)
00041     Q_FLAGS(Options)
00042 
00043 public:
00044 
00050     enum Option {
00051         EditTime         = 0x0001,  
00052         SelectTime       = 0x0002,  
00053         ForceTime        = 0x0004,  
00054         WarnOnInvalid    = 0x0008   
00055     };
00056     Q_DECLARE_FLAGS(Options, Option)
00057 
00058     
00061     explicit KTimeComboBox(QWidget *parent = 0);
00062 
00066     virtual ~KTimeComboBox();
00067 
00073     QTime time() const;
00074 
00083     bool isValid() const;
00084 
00091     bool isNull() const;
00092 
00098     Options options() const;
00099 
00107     KLocale::TimeFormatOptions displayFormat() const;
00108 
00114     QTime minimumTime() const;
00115 
00119     void resetMinimumTime();
00120 
00126     QTime maximumTime() const;
00127 
00131     void resetMaximumTime();
00132 
00143     void setTimeRange(const QTime &minTime,
00144                       const QTime &maxTime,
00145                       const QString &minWarnMsg = QString(),
00146                       const QString &maxWarnMsg = QString());
00147 
00151     void resetTimeRange();
00152 
00161     int timeListInterval() const;
00162 
00171     QList<QTime> timeList() const;
00172 
00173 Q_SIGNALS:
00174 
00182     void timeEntered(const QTime &time);
00183 
00192     void timeChanged(const QTime &time);
00193 
00201     void timeEdited(const QTime &time);
00202 
00203 public Q_SLOTS:
00204 
00213     void setTime(const QTime &time);
00214 
00220     void setOptions(Options options);
00221 
00229     void setDisplayFormat(KLocale::TimeFormatOptions formatOptions);
00230 
00244     void setMinimumTime(const QTime &minTime, const QString &minWarnMsg = QString());
00245 
00259     void setMaximumTime(const QTime &maxTime, const QString &maxWarnMsg = QString());
00260 
00280     void setTimeListInterval(int minutes);
00281 
00299     void setTimeList(QList<QTime> timeList,
00300                      const QString &minWarnMsg = QString(),
00301                      const QString &maxWarnMsg = QString());
00302 
00303 protected:
00304 
00305     virtual bool eventFilter(QObject *object, QEvent *event);
00306     virtual void showPopup();
00307     virtual void hidePopup();
00308     virtual void mousePressEvent(QMouseEvent *event);
00309     virtual void wheelEvent(QWheelEvent *event);
00310     virtual void keyPressEvent(QKeyEvent *event);
00311     virtual void focusInEvent(QFocusEvent *event);
00312     virtual void focusOutEvent(QFocusEvent *event);
00313     virtual void resizeEvent(QResizeEvent *event);
00314 
00322     virtual void assignTime(const QTime &time);
00323 
00324 private:
00325 
00326     friend class KTimeComboBoxPrivate;
00327     KTimeComboBoxPrivate *const d;
00328 
00329     Q_PRIVATE_SLOT(d, void selectTime(int index))
00330     Q_PRIVATE_SLOT(d, void editTime(const QString&))
00331     Q_PRIVATE_SLOT(d, void enterTime(const QTime&))
00332     Q_PRIVATE_SLOT(d, void parseTime())
00333 
00334 };
00335 
00336 Q_DECLARE_OPERATORS_FOR_FLAGS(KTimeComboBox::Options)
00337 
00338 #endif // KTIMECOMBOBOX_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