The Q3TimeEdit class provides a time editor. 更多...
| 头: | #include <Q3TimeEdit> |
| 继承: | Q3DateTimeEditBase |
| enum | 显示 { Hours, Minutes, Seconds, AMPM } |
|
| Q3TimeEdit (QWidget * parent = 0, const char * name = 0) | |
| Q3TimeEdit (const QTime & time , QWidget * parent = 0, const char * name = 0) | |
| ~Q3TimeEdit () | |
| bool | autoAdvance () const |
| uint | display () const |
| QTime | maxValue () const |
| QTime | minValue () const |
| QString | separator () const |
| virtual void | setAutoAdvance (bool advance ) |
| void | setDisplay (uint disp ) |
| virtual void | setMaxValue (const QTime & d ) |
| virtual void | setMinValue (const QTime & d ) |
| virtual void | setRange (const QTime & min , const QTime & max ) |
| virtual void | setSeparator (const QString & s ) |
| QTime | time () const |
| virtual QSize | minimumSizeHint () const |
| virtual QSize | sizeHint () const |
| virtual void | setTime (const QTime & time ) |
| void | valueChanged (const QTime & time ) |
| virtual void | setHour (int h ) |
| virtual void | setMinute (int m ) |
| virtual void | setSecond (int s ) |
| virtual bool | event (QEvent * e ) |
| virtual void | resizeEvent (QResizeEvent *) |
| virtual QString | sectionFormattedText (int sec ) |
| virtual void | timerEvent (QTimerEvent * e ) |
The Q3TimeEdit class provides a time editor.
Q3TimeEdit allows the user to edit times by using the keyboard or the arrow keys to increase/decrease time values. The arrow keys can be used to move from section to section within the Q3TimeEdit box. The user can automatically be moved to the next section once they complete a section using setAutoAdvance (). Times appear in hour, minute, second order. It is recommended that the Q3TimeEdit is initialised with a time, e.g.
QTime timeNow = QTime::currentTime(); Q3TimeEdit *timeEdit = new Q3TimeEdit(timeNow, this); timeEdit->setRange(timeNow, timeNow.addSecs(60 * 60));
Here we've created a Q3TimeEdit widget set to the current time. We've also set the minimum value to the current time and the maximum time to one hour from now.
The maximum and minimum values for a time value in the time editor default to the maximum and minimum values for a QTime . You can change this by calling setMinValue (), setMaxValue () 或 setRange ().
Terminology: A QTimeWidget consists of three sections, one each for the hour, minute and second. You can change the separator character using setSeparator (), by default the separator is read from the system's settings.
另请参阅 QTime , Q3DateEdit ,和 Q3DateTimeEdit .
This enum defines the sections that comprise a time
| 常量 | 值 | 描述 |
|---|---|---|
Q3TimeEdit::Hours
|
0x01
|
The hours section |
Q3TimeEdit::Minutes
|
0x02
|
The minutes section |
Q3TimeEdit::Seconds
|
0x04
|
The seconds section |
Q3TimeEdit::AMPM
|
0x10
|
The AM/PM section |
The values can be or'ed together to show any combination.
This property holds whether the editor automatically advances to the next section.
If autoAdvance is true, the editor will automatically advance focus to the next time section if a user has completed a section. The default is false.
访问函数:
| bool | autoAdvance () const |
| virtual void | setAutoAdvance (bool advance ) |
This property holds the sections that are displayed in the time edit.
The value can be any combination of the values in the Display enum. By default, the widget displays hours, minutes and seconds.
访问函数:
| uint | display () const |
| void | setDisplay (uint disp ) |
This property holds the maximum time value.
Setting the maximum time value is equivalent to calling Q3TimeEdit::setRange ( minValue (), t ), where t is the maximum time. The default maximum time is 23:59:59.
访问函数:
| QTime | maxValue () const |
| virtual void | setMaxValue (const QTime & d ) |
另请参阅 minValue and setRange ().
This property holds the minimum time value.
Setting the minimum time value is equivalent to calling Q3TimeEdit::setRange ( t , maxValue ()), where t is the minimum time. The default minimum time is 00:00:00.
访问函数:
| QTime | minValue () const |
| virtual void | setMinValue (const QTime & d ) |
另请参阅 maxValue and setRange ().
This property holds the editor's time value.
When changing the time property, if the time is less than minValue (), or is greater than maxValue (), nothing happens.
访问函数:
| QTime | time () const |
| virtual void | setTime (const QTime & time ) |
Constructs an empty time edit with parent parent and called name .
这是重载函数。
Constructs a time edit with the initial time value, time , parent parent and called name .
销毁对象并释放任何分配资源。
[virtual protected]
bool
Q3TimeEdit::
event
(
QEvent
*
e
)
重实现自 QObject::event ().
[虚拟]
QSize
Q3TimeEdit::
minimumSizeHint
() const
重实现自 QWidget::minimumSizeHint ().
[virtual protected]
void
Q3TimeEdit::
resizeEvent
(
QResizeEvent
*)
重实现自 QWidget::resizeEvent ().
[virtual protected]
QString
Q3TimeEdit::
sectionFormattedText
(
int
sec
)
Returns the formatted number for section sec . This will correspond to either the hour, minute or second section, depending on sec .
Returns the editor's separator.
另请参阅 setSeparator ().
[virtual protected]
void
Q3TimeEdit::
setHour
(
int
h
)
Sets the hour to h , which must be a valid hour, i.e. in the range 0..24.
[virtual protected]
void
Q3TimeEdit::
setMinute
(
int
m
)
Sets the minute to m , which must be a valid minute, i.e. in the range 0..59.
[虚拟]
void
Q3TimeEdit::
setRange
(const
QTime
&
min
, const
QTime
&
max
)
Sets the valid input range for the editor to be from min to max inclusive. If min is invalid no minimum time is set. Similarly, if max is invalid no maximum time is set.
[virtual protected]
void
Q3TimeEdit::
setSecond
(
int
s
)
Sets the second to s , which must be a valid second, i.e. in the range 0..59.
[虚拟]
void
Q3TimeEdit::
setSeparator
(const
QString
&
s
)
Sets the separator to s . Note that currently only the first character of s 被使用。
另请参阅 separator ().
[虚拟]
QSize
Q3TimeEdit::
sizeHint
() const
重实现自 QWidget::sizeHint ().
[virtual protected]
void
Q3TimeEdit::
timerEvent
(
QTimerEvent
*
e
)
重实现自 QObject::timerEvent ().
[signal]
void
Q3TimeEdit::
valueChanged
(const
QTime
&
time
)
This signal is emitted whenever the editor's value changes. The time parameter is the new value.