The Q3DateTimeEdit class combines a Q3DateEdit and Q3TimeEdit widget into a single widget for editing datetimes. 更多...
| 头: | #include <Q3DateTimeEdit> |
| 继承: | QWidget |
| Q3DateTimeEdit (QWidget * parent = 0, const char * name = 0) | |
| Q3DateTimeEdit (const QDateTime & datetime , QWidget * parent = 0, const char * name = 0) | |
| ~Q3DateTimeEdit () | |
| bool | autoAdvance () const |
| Q3DateEdit * | dateEdit () |
| QDateTime | dateTime () const |
| virtual void | setAutoAdvance (bool advance ) |
| Q3TimeEdit * | timeEdit () |
| virtual QSize | minimumSizeHint () const |
| virtual QSize | sizeHint () const |
| virtual void | setDateTime (const QDateTime & dt ) |
| void | valueChanged (const QDateTime & datetime ) |
| virtual void | resizeEvent (QResizeEvent * event ) |
The Q3DateTimeEdit class combines a Q3DateEdit and Q3TimeEdit widget into a single widget for editing datetimes.
Q3DateTimeEdit consists of a Q3DateEdit and Q3TimeEdit widget placed side by side and offers the functionality of both. The user can edit the date and time by using the keyboard or the arrow keys to increase/decrease date or time values. The Tab key can be used to move from section to section within the Q3DateTimeEdit widget, and the user can be moved automatically when they complete a section using setAutoAdvance (). The datetime can be set with setDateTime ().
The date format is read from the system's locale settings. It is set to year, month, day order if that is not possible. See Q3DateEdit::setOrder () to change this. Times appear in the order hours, minutes, seconds using the 24 hour clock.
It is recommended that the Q3DateTimeEdit is initialised with a datetime, e.g.
Q3DateTimeEdit *dateTimeEdit = new Q3DateTimeEdit(QDateTime::currentDateTime(), this); dateTimeEdit->dateEdit()->setRange(QDateTime::currentDate(), QDateTime::currentDate().addDays(7));
Here we've created a new Q3DateTimeEdit set to the current date and time, and set the date to have a minimum date of now and a maximum date of a week from now.
Terminology: A Q3DateEdit widget consists of three 'sections', one each for the year, month and day. Similarly a Q3TimeEdit consists of three sections, one each for the hour, minute and second. The character that separates each date section is specified with setDateSeparator(); similarly setTimeSeparator() is used for the time sections.
另请参阅 Q3DateEdit and Q3TimeEdit .
This property holds the editor's datetime value.
The datetime edit's datetime which may be an invalid datetime.
访问函数:
| QDateTime | dateTime () const |
| virtual void | setDateTime (const QDateTime & dt ) |
Constructs an empty datetime edit with parent parent and called name .
这是重载函数。
Constructs a datetime edit with the initial value datetime , parent parent and called name .
销毁对象并释放任何分配资源。
Returns true if auto-advance is enabled, otherwise returns false.
另请参阅 setAutoAdvance ().
Returns the internal widget used for editing the date part of the datetime.
[虚拟]
QSize
Q3DateTimeEdit::
minimumSizeHint
() const
重实现自 QWidget::minimumSizeHint ().
[virtual protected]
void
Q3DateTimeEdit::
resizeEvent
(
QResizeEvent
*
event
)
重实现自 QWidget::resizeEvent ().
Intercepts and handles the resize event , which hase a special meaning for the Q3DateTimeEdit .
[虚拟]
void
Q3DateTimeEdit::
setAutoAdvance
(
bool
advance
)
Sets the auto advance property of the editor to advance . If set to true, the editor will automatically advance focus to the next date or time section if the user has completed a section.
另请参阅 autoAdvance ().
[虚拟]
QSize
Q3DateTimeEdit::
sizeHint
() const
重实现自 QWidget::sizeHint ().
Returns the internal widget used for editing the time part of the datetime.
[signal]
void
Q3DateTimeEdit::
valueChanged
(const
QDateTime
&
datetime
)
This signal is emitted every time the date or time changes. The datetime argument is the new datetime.