• 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
timespinbox.h
Go to the documentation of this file.
1 /*
2  * timespinbox.h - time spinbox widget
3  * Program: kalarm
4  * Copyright © 2001-2008 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 TIMESPINBOX_H
22 #define TIMESPINBOX_H
23 
24 #include "spinbox2.h"
25 #include <QDateTime>
26 
27 
45 class TimeSpinBox : public SpinBox2
46 {
47  Q_OBJECT
48  public:
54  explicit TimeSpinBox(bool use24hour, QWidget* parent = 0);
60  TimeSpinBox(int minMinute, int maxMinute, QWidget* parent = 0);
64  bool isValid() const;
69  void setValid(bool);
71  virtual QValidator::State validate(QString&, int& pos) const;
75  QTime time() const;
79  virtual void setMinimum(int minutes);
83  virtual void setMaximum(int minutes) { SpinBox2::setMaximum(minutes); }
85  void setMaximum(const QTime& t) { SpinBox2::setMaximum(t.hour()*60 + t.minute()); }
87  QTime maxTime() const { int mv = maximum(); return QTime(mv/60, mv%60); }
91  virtual void stepBy(int increment);
95  static QString shiftWhatsThis();
96 
97  virtual QSize sizeHint() const;
98  virtual QSize minimumSizeHint() const;
99 
100  public slots:
104  virtual void setValue(int minutes);
106  void setValue(const QTime& t) { setValue(t.hour()*60 + t.minute()); }
107 
108  protected:
109  virtual QString textFromValue(int v) const;
110  virtual int valueFromText(const QString&) const;
111 
112  private slots:
113  void slotValueChanged(int value);
114 
115  private:
116  int mMinimumValue; // real minimum value, excluding special value for "**:**"
117  bool m12Hour; // use 12-hour clock
118  bool mPm; // use PM for manually entered values (with 12-hour clock)
119  bool mInvalid; // value is currently invalid (asterisks)
120  bool mEnteredSetValue; // to prevent infinite recursion in setValue()
121 };
122 
123 #endif // TIMESPINBOX_H
124 
125 // vim: et sw=4:
TimeSpinBox::TimeSpinBox
TimeSpinBox(bool use24hour, QWidget *parent=0)
Constructor for a wrapping time spin box which can be used to enter a time of day.
Definition: timespinbox.cpp:43
QTime::minute
int minute() const
TimeSpinBox::time
QTime time() const
Returns the current value held in the spin box.
Definition: timespinbox.cpp:80
QWidget
TimeSpinBox::textFromValue
virtual QString textFromValue(int v) const
Definition: timespinbox.cpp:85
TimeSpinBox::setValid
void setValid(bool)
Sets the spin box as holding a valid or invalid value.
Definition: timespinbox.cpp:172
TimeSpinBox
Hours/minutes time entry widget.
Definition: timespinbox.h:45
TimeSpinBox::setValue
void setValue(const QTime &t)
Sets the value of the spin box.
Definition: timespinbox.h:106
QTime
TimeSpinBox::isValid
bool isValid() const
Returns true if the spin box holds a valid value.
Definition: timespinbox.cpp:237
TimeSpinBox::sizeHint
virtual QSize sizeHint() const
Definition: timespinbox.cpp:247
QWidget::pos
QPoint pos() const
QString
TimeSpinBox::setMinimum
virtual void setMinimum(int minutes)
Sets the maximum value which can be held in the spin box.
Definition: timespinbox.cpp:194
TimeSpinBox::stepBy
virtual void stepBy(int increment)
Called whenever the user triggers a step, to adjust the value of the spin box.
Definition: timespinbox.cpp:229
QTime::hour
int hour() const
SpinBox2::value
int value() const
Returns the current value of the spin box.
Definition: spinbox2.h:142
TimeSpinBox::setMaximum
void setMaximum(const QTime &t)
Sets the maximum value which can be held in the spin box.
Definition: timespinbox.h:85
SpinBox2
Spin box with a pair of spin buttons on either side.
Definition: spinbox2.h:57
QSize
spinbox2.h
TimeSpinBox::setValue
virtual void setValue(int minutes)
Sets the value of the spin box.
Definition: timespinbox.cpp:203
TimeSpinBox::validate
virtual QValidator::State validate(QString &, int &pos) const
Determine whether the current input is valid.
Definition: timespinbox.cpp:266
TimeSpinBox::valueFromText
virtual int valueFromText(const QString &) const
Definition: timespinbox.cpp:106
SpinBox2::maximum
int maximum() const
Returns the maximum value of the spin box.
Definition: spinbox2.h:134
SpinBox2::setMaximum
virtual void setMaximum(int val)
Sets the maximum value of the spin box.
Definition: spinbox2.cpp:214
TimeSpinBox::minimumSizeHint
virtual QSize minimumSizeHint() const
Definition: timespinbox.cpp:254
TimeSpinBox::shiftWhatsThis
static QString shiftWhatsThis()
Returns a text describing use of the shift key as an accelerator for the spin buttons, designed for incorporation into WhatsThis texts.
Definition: timespinbox.cpp:75
TimeSpinBox::setMaximum
virtual void setMaximum(int minutes)
Sets the maximum value which can be held in the spin box.
Definition: timespinbox.h:83
TimeSpinBox::maxTime
QTime maxTime() const
Returns the maximum value which can be held in the spin box.
Definition: timespinbox.h:87
QObject::parent
QObject * parent() const
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