kalarm/lib
timeedit.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef TIMEEDIT_H
00022 #define TIMEEDIT_H
00023
00024 #include <qdatetime.h>
00025 #include <qhbox.h>
00026
00027 class ComboBox;
00028 class TimeSpinBox;
00029
00030
00050 class TimeEdit : public QHBox
00051 {
00052 Q_OBJECT
00053 public:
00058 explicit TimeEdit(QWidget* parent = 0, const char* name = 0);
00060 bool isReadOnly() const { return mReadOnly; }
00066 virtual void setReadOnly(bool readOnly);
00068 bool isValid() const;
00074 void setValid(bool valid);
00076 int value() const;
00078 QTime time() const { int m = value(); return QTime(m/60, m%60); }
00080 bool wrapping() const;
00084 void setWrapping(bool on);
00086 int minValue() const;
00088 int maxValue() const;
00090 QTime maxTime() const { int mv = maxValue(); return QTime(mv/60, mv%60); }
00092 void setMinValue(int minutes);
00094 void setMaxValue(int minutes);
00096 void setMaxValue(const QTime& time) { setMaxValue(time.hour()*60 + time.minute()); }
00097 public slots:
00099 virtual void setValue(int minutes);
00101 void setValue(const QTime& t) { setValue(t.hour()*60 + t.minute()); }
00102 signals:
00107 void valueChanged(int minutes);
00108
00109 private slots:
00110 void slotValueChanged(int);
00111 void slotAmPmChanged(int item);
00112 private:
00113 void setAmPmCombo(int am, int pm);
00114
00115 TimeSpinBox* mSpinBox;
00116 ComboBox* mAmPm;
00117 int mAmIndex;
00118 int mPmIndex;
00119 bool mReadOnly;
00120 };
00121
00122 #endif // TIMEEDIT_H
|