kalarm/lib
timespinbox.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef TIMESPINBOX_H
00022 #define TIMESPINBOX_H
00023
00024 #include <qdatetime.h>
00025 #include "spinbox2.h"
00026
00027
00045 class TimeSpinBox : public SpinBox2
00046 {
00047 Q_OBJECT
00048 public:
00055 TimeSpinBox(bool use24hour, QWidget* parent = 0, const char* name = 0);
00062 TimeSpinBox(int minMinute, int maxMinute, QWidget* parent = 0, const char* name = 0);
00066 bool isValid() const;
00071 void setValid(bool);
00075 QTime time() const;
00079 void setMaxValue(int minutes) { SpinBox2::setMaxValue(minutes); }
00081 void setMaxValue(const QTime& t) { SpinBox2::setMaxValue(t.hour()*60 + t.minute()); }
00083 QTime maxTime() const { int mv = maxValue(); return QTime(mv/60, mv%60); }
00087 static QString shiftWhatsThis();
00088
00089 public slots:
00093 virtual void setValue(int minutes);
00095 void setValue(const QTime& t) { setValue(t.hour()*60 + t.minute()); }
00099 virtual void stepUp();
00103 virtual void stepDown();
00104
00105 protected:
00106 virtual QString mapValueToText(int v);
00107 virtual int mapTextToValue(bool* ok);
00108 private slots:
00109 void slotValueChanged(int value);
00110 private:
00111 class TimeValidator;
00112 TimeValidator* mValidator;
00113 int mMinimumValue;
00114 bool m12Hour;
00115 bool mPm;
00116 bool mInvalid;
00117 bool mEnteredSetValue;
00118 };
00119
00120 #endif // TIMESPINBOX_H
|