• 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.14
  • 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 
26 class ComboBox;
27 class TimeSpinBox;
28 
29 
49 class TimeEdit : public KHBox
50 {
51  Q_OBJECT
52  public:
56  explicit TimeEdit(QWidget* parent = 0);
58  bool isReadOnly() const { return mReadOnly; }
64  virtual void setReadOnly(bool readOnly);
66  bool isValid() const;
72  void setValid(bool valid);
74  int value() const;
76  QTime time() const { int m = value(); return QTime(m/60, m%60); }
78  bool wrapping() const;
82  void setWrapping(bool on);
84  int minimum() const;
86  int maximum() const;
88  QTime maxTime() const { int mv = maximum(); return QTime(mv/60, mv%60); }
90  void setMinimum(int minutes);
92  void setMaximum(int minutes);
94  void setMaximum(const QTime& time) { setMaximum(time.hour()*60 + time.minute()); }
95 
96  public slots:
98  virtual void setValue(int minutes);
100  void setValue(const QTime& t) { setValue(t.hour()*60 + t.minute()); }
101 
102  signals:
107  void valueChanged(int minutes);
108 
109  private slots:
110  void slotValueChanged(int);
111  void slotAmPmChanged(int item);
112 
113  private:
114  void setAmPmCombo(int am, int pm);
115 
116  TimeSpinBox* mSpinBox; // always holds the 24-hour time
117  ComboBox* mAmPm;
118  int mAmIndex; // mAmPm index to "am", or -1 if none
119  int mPmIndex; // mAmPm index to "pm", or -1 if none
120  bool mReadOnly; // the widget is read only
121 };
122 
123 #endif // TIMEEDIT_H
124 
125 // vim: et sw=4:
QTime::minute
int minute() const
QWidget
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:52
TimeEdit::isValid
bool isValid() const
Returns true if the widget contains a valid value.
Definition: timeedit.cpp:68
TimeEdit::minimum
int minimum() const
Returns the minimum value of the widget in minutes.
Definition: timeedit.cpp:113
QTime
TimeEdit::maximum
int maximum() const
Returns the maximum value of the widget in minutes.
Definition: timeedit.cpp:118
TimeEdit::isReadOnly
bool isReadOnly() const
Returns true if the widget is read only.
Definition: timeedit.h:58
TimeEdit::setMinimum
void setMinimum(int minutes)
Sets the minimum value of the widget.
Definition: timeedit.cpp:123
TimeEdit
Widget to enter a time of day.
Definition: timeedit.h:49
TimeEdit::maxTime
QTime maxTime() const
Returns the maximum value of the widget as a QTime value.
Definition: timeedit.h:88
TimeEdit::setValue
void setValue(const QTime &t)
Sets the value of the widget.
Definition: timeedit.h:100
QTime::hour
int hour() const
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:108
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:93
TimeEdit::setMaximum
void setMaximum(const QTime &time)
Sets the maximum value of the widget.
Definition: timeedit.h:94
TimeEdit::setValid
void setValid(bool valid)
Sets whether the edit value is valid.
Definition: timeedit.cpp:78
KHBox
ComboBox
A KComboBox with read-only option.
Definition: combobox.h:39
TimeEdit::TimeEdit
TimeEdit(QWidget *parent=0)
Constructor.
Definition: timeedit.cpp:32
TimeEdit::value
int value() const
Returns the entered time as a value in minutes.
Definition: timeedit.cpp:63
TimeEdit::time
QTime time() const
Returns the entered time as a QTime value.
Definition: timeedit.h:76
TimeEdit::setMaximum
void setMaximum(int minutes)
Sets the maximum value of the widget.
Definition: timeedit.cpp:130
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:103
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:35:02 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
  • pimprint

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