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

kalarm/lib

  • sources
  • kde-4.12
  • kdepim
  • kalarm
  • lib
timeedit.h
Go to the documentation of this file.
1 /*
2  * timeedit.h - time-of-day edit widget, with AM/PM shown depending on locale
3  * Program: kalarm
4  * Copyright © 2004-2006 by David Jarvie <djarvie@kde.org>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19  */
20 
21 #ifndef TIMEEDIT_H
22 #define TIMEEDIT_H
23 
24 #include <khbox.h>
25 #include <QDateTime>
26 
27 class ComboBox;
28 class TimeSpinBox;
29 
30 
50 class TimeEdit : public KHBox
51 {
52  Q_OBJECT
53  public:
57  explicit TimeEdit(QWidget* parent = 0);
59  bool isReadOnly() const { return mReadOnly; }
65  virtual void setReadOnly(bool readOnly);
67  bool isValid() const;
73  void setValid(bool valid);
75  int value() const;
77  QTime time() const { int m = value(); return QTime(m/60, m%60); }
79  bool wrapping() const;
83  void setWrapping(bool on);
85  int minimum() const;
87  int maximum() const;
89  QTime maxTime() const { int mv = maximum(); return QTime(mv/60, mv%60); }
91  void setMinimum(int minutes);
93  void setMaximum(int minutes);
95  void setMaximum(const QTime& time) { setMaximum(time.hour()*60 + time.minute()); }
96 
97  public slots:
99  virtual void setValue(int minutes);
101  void setValue(const QTime& t) { setValue(t.hour()*60 + t.minute()); }
102 
103  signals:
108  void valueChanged(int minutes);
109 
110  private slots:
111  void slotValueChanged(int);
112  void slotAmPmChanged(int item);
113 
114  private:
115  void setAmPmCombo(int am, int pm);
116 
117  TimeSpinBox* mSpinBox; // always holds the 24-hour time
118  ComboBox* mAmPm;
119  int mAmIndex; // mAmPm index to "am", or -1 if none
120  int mPmIndex; // mAmPm index to "pm", or -1 if none
121  bool mReadOnly; // the widget is read only
122 };
123 
124 #endif // TIMEEDIT_H
125 
126 // vim: et sw=4:
TimeSpinBox
Hours/minutes time entry widget.
Definition: timespinbox.h:45
TimeEdit::setReadOnly
virtual void setReadOnly(bool readOnly)
Sets whether the widget is read-only for the user.
Definition: timeedit.cpp:51
QWidget
TimeEdit::isValid
bool isValid() const
Returns true if the widget contains a valid value.
Definition: timeedit.cpp:67
TimeEdit::minimum
int minimum() const
Returns the minimum value of the widget in minutes.
Definition: timeedit.cpp:112
TimeEdit::maximum
int maximum() const
Returns the maximum value of the widget in minutes.
Definition: timeedit.cpp:117
TimeEdit::isReadOnly
bool isReadOnly() const
Returns true if the widget is read only.
Definition: timeedit.h:59
TimeEdit::setMinimum
void setMinimum(int minutes)
Sets the minimum value of the widget.
Definition: timeedit.cpp:122
TimeEdit
Widget to enter a time of day.
Definition: timeedit.h:50
TimeEdit::maxTime
QTime maxTime() const
Returns the maximum value of the widget as a QTime value.
Definition: timeedit.h:89
TimeEdit::setValue
void setValue(const QTime &t)
Sets the value of the widget.
Definition: timeedit.h:101
TimeEdit::setWrapping
void setWrapping(bool on)
Sets whether it is possible to step the value from the highest value to the lowest value and vice ver...
Definition: timeedit.cpp:107
TimeEdit::valueChanged
void valueChanged(int minutes)
This signal is emitted every time the value of the widget changes (for whatever reason).
TimeEdit::setValue
virtual void setValue(int minutes)
Sets the value of the widget.
Definition: timeedit.cpp:92
TimeEdit::setMaximum
void setMaximum(const QTime &time)
Sets the maximum value of the widget.
Definition: timeedit.h:95
TimeEdit::setValid
void setValid(bool valid)
Sets whether the edit value is valid.
Definition: timeedit.cpp:77
KHBox
ComboBox
A KComboBox with read-only option.
Definition: combobox.h:39
TimeEdit::TimeEdit
TimeEdit(QWidget *parent=0)
Constructor.
Definition: timeedit.cpp:31
TimeEdit::value
int value() const
Returns the entered time as a value in minutes.
Definition: timeedit.cpp:62
TimeEdit::time
QTime time() const
Returns the entered time as a QTime value.
Definition: timeedit.h:77
TimeEdit::setMaximum
void setMaximum(int minutes)
Sets the maximum value of the widget.
Definition: timeedit.cpp:129
TimeEdit::wrapping
bool wrapping() const
Returns true if it is possible to step the value from the highest value to the lowest value and vice ...
Definition: timeedit.cpp:102
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:59:21 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kalarm/lib

Skip menu "kalarm/lib"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdepim API Reference

Skip menu "kdepim API Reference"
  • akonadi_next
  • akregator
  • blogilo
  • calendarsupport
  • console
  •   kabcclient
  •   konsolekalendar
  • kaddressbook
  • kalarm
  •   lib
  • kdgantt2
  • kjots
  • kleopatra
  • kmail
  • knode
  • knotes
  • kontact
  • korgac
  • korganizer
  • ktimetracker
  • libkdepim
  • libkleo
  • libkpgp
  • mailcommon
  • messagelist
  • messageviewer

Search



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