Movatterモバイル変換


[0]ホーム

URL:


We bake cookies in your browser for a better experience. Using this site means that you consent.Read More

Menu

Qt Documentation

  • Qt 4.8
  • Qt3SupportLight
  • Q3TimeEdit

Q3TimeEdit Class

TheQ3TimeEdit class provides a time editor.More...

Header:#include <Q3TimeEdit>
Inherits:Q3DateTimeEditBase

Public Types

enumDisplay { Hours, Minutes, Seconds, AMPM }

Properties

Public Functions

Q3TimeEdit(QWidget * parent = 0, const char * name = 0)
Q3TimeEdit(const QTime & time, QWidget * parent = 0, const char * name = 0)
~Q3TimeEdit()
boolautoAdvance() const
uintdisplay() const
QTimemaxValue() const
QTimeminValue() const
QStringseparator() const
virtual voidsetAutoAdvance(bool advance)
voidsetDisplay(uint disp)
virtual voidsetMaxValue(const QTime & d)
virtual voidsetMinValue(const QTime & d)
virtual voidsetRange(const QTime & min, const QTime & max)
virtual voidsetSeparator(const QString & s)
QTimetime() const

Reimplemented Public Functions

virtual QSizeminimumSizeHint() const
virtual QSizesizeHint() const

Public Slots

virtual voidsetTime(const QTime & time)
  • 19 public slots inherited fromQWidget
  • 1 public slot inherited fromQObject

Signals

voidvalueChanged(const QTime & time)

Protected Functions

virtual voidsetHour(int h)
virtual voidsetMinute(int m)
virtual voidsetSecond(int s)

Reimplemented Protected Functions

virtual boolevent(QEvent * e)
virtual voidresizeEvent(QResizeEvent *)
virtual QStringsectionFormattedText(int sec)
virtual voidtimerEvent(QTimerEvent * e)
  • 37 protected functions inherited fromQWidget
  • 8 protected functions inherited fromQObject
  • 1 protected function inherited fromQPaintDevice

Additional Inherited Members

  • 4 static public members inherited fromQWidget
  • 7 static public members inherited fromQObject
  • 1 protected slot inherited fromQWidget

Detailed Description

TheQ3TimeEdit 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 theQ3TimeEdit box. The user can automatically be moved to the next section once they complete a section usingsetAutoAdvance(). Times appear in hour, minute, second order. It is recommended that theQ3TimeEdit is initialised with a time, e.g.

QTime timeNow=QTime::currentTime();Q3TimeEdit*timeEdit=newQ3TimeEdit(timeNow,this);timeEdit->setRange(timeNow, timeNow.addSecs(60*60));

Here we've created aQ3TimeEdit 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 aQTime. You can change this by callingsetMinValue(),setMaxValue() orsetRange().

Terminology: A QTimeWidget consists of three sections, one each for the hour, minute and second. You can change the separator character usingsetSeparator(), by default the separator is read from the system's settings.

Date Time Widgets

See alsoQTime,Q3DateEdit, andQ3DateTimeEdit.

Member Type Documentation

enum Q3TimeEdit::Display

This enum defines the sections that comprise a time

ConstantValueDescription
Q3TimeEdit::Hours0x01The hours section
Q3TimeEdit::Minutes0x02The minutes section
Q3TimeEdit::Seconds0x04The seconds section
Q3TimeEdit::AMPM0x10The AM/PM section

The values can be or'ed together to show any combination.

Property Documentation

autoAdvance :bool

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.

Access functions:

boolautoAdvance() const
virtual voidsetAutoAdvance(bool advance)

display :Display

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.

Access functions:

uintdisplay() const
voidsetDisplay(uint disp)

maxValue :QTime

This property holds the maximum time value.

Setting the maximum time value is equivalent to callingQ3TimeEdit::setRange(minValue(),t), wheret is the maximum time. The default maximum time is 23:59:59.

Access functions:

QTimemaxValue() const
virtual voidsetMaxValue(const QTime & d)

See alsominValue andsetRange().

minValue :QTime

This property holds the minimum time value.

Setting the minimum time value is equivalent to callingQ3TimeEdit::setRange(t,maxValue()), wheret is the minimum time. The default minimum time is 00:00:00.

Access functions:

QTimeminValue() const
virtual voidsetMinValue(const QTime & d)

See alsomaxValue andsetRange().

time :QTime

This property holds the editor's time value.

When changing the time property, if the time is less thanminValue(), or is greater thanmaxValue(), nothing happens.

Access functions:

QTimetime() const
virtual voidsetTime(const QTime & time)

Member Function Documentation

Q3TimeEdit::Q3TimeEdit(QWidget * parent = 0, constchar * name = 0)

Constructs an empty time edit with parentparent and calledname.

Q3TimeEdit::Q3TimeEdit(constQTime & time,QWidget * parent = 0, constchar * name = 0)

This is an overloaded function.

Constructs a time edit with the initial time value,time, parentparent and calledname.

Q3TimeEdit::~Q3TimeEdit()

Destroys the object and frees any allocated resources.

[virtual protected]bool Q3TimeEdit::event(QEvent * e)

Reimplemented fromQObject::event().

[virtual]QSize Q3TimeEdit::minimumSizeHint() const

Reimplemented fromQWidget::minimumSizeHint().

[virtual protected]void Q3TimeEdit::resizeEvent(QResizeEvent *)

Reimplemented fromQWidget::resizeEvent().

[virtual protected]QString Q3TimeEdit::sectionFormattedText(int sec)

Returns the formatted number for sectionsec. This will correspond to either the hour, minute or second section, depending onsec.

QString Q3TimeEdit::separator() const

Returns the editor's separator.

See alsosetSeparator().

[virtual protected]void Q3TimeEdit::setHour(int h)

Sets the hour toh, which must be a valid hour, i.e. in the range 0..24.

[virtual protected]void Q3TimeEdit::setMinute(int m)

Sets the minute tom, which must be a valid minute, i.e. in the range 0..59.

[virtual]void Q3TimeEdit::setRange(constQTime & min, constQTime & max)

Sets the valid input range for the editor to be frommin tomax inclusive. Ifmin is invalid no minimum time is set. Similarly, ifmax is invalid no maximum time is set.

[virtual protected]void Q3TimeEdit::setSecond(int s)

Sets the second tos, which must be a valid second, i.e. in the range 0..59.

[virtual]void Q3TimeEdit::setSeparator(constQString & s)

Sets the separator tos. Note that currently only the first character ofs is used.

See alsoseparator().

[virtual]QSize Q3TimeEdit::sizeHint() const

Reimplemented fromQWidget::sizeHint().

[virtual protected]void Q3TimeEdit::timerEvent(QTimerEvent * e)

Reimplemented fromQObject::timerEvent().

[signal]void Q3TimeEdit::valueChanged(constQTime & time)

This signal is emitted whenever the editor's value changes. Thetime parameter is the new value.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.


[8]ページ先頭

©2009-2025 Movatter.jp