Pages
API Documentation
On this page

KTimeComboBox Class

A combobox for times. More...

  • Header: #include <KTimeComboBox>
  • CMake: find_package(KF6 REQUIRED COMPONENTS WidgetsAddons)
    target_link_libraries(mytarget PRIVATE KF6::WidgetsAddons)
  • Inherits: QComboBox

List of all members, including inherited members

Public Types

Properties

Public Functions

Public Slots

Signals

Protected Functions

Detailed Description

Member Type Documentation

enum KTimeComboBox::Option

flags KTimeComboBox::Options

Options provided by the widget

Constant Value Description
KTimeComboBox::EditTime 0x0001 Allow the user to manually edit the time in the combo line edit
KTimeComboBox::SelectTime 0x0002 Allow the user to select the time from a drop-down menu
KTimeComboBox::ForceTime 0x0004 Any set or entered time will be forced to one of the drop-down times
KTimeComboBox::WarnOnInvalid 0x0008 Show a warning box on focus out if the user enters an invalid time

The Options type is a typedef for QFlags<Option>. It stores an OR combination of Option values.

See also options, setOptions

Property Documentation

maximumTime : QTime

Access functions:

minimumTime : QTime

Access functions:

options : Options

Access functions:

  • KTimeComboBox::Options options() const
  • void setOptions(KTimeComboBox::Options options)

time : QTime

Access functions:

Notifier signal:

timeListInterval : int

Access functions:

Member Function Documentation

[explicit] KTimeComboBox::KTimeComboBox(QWidget *parent = nullptr)

Create a new KTimeComboBox widget

[virtual protected] void KTimeComboBox::assignTime(const QTime &time)

Assign the time for the widget.

Virtual to allow sub-classes to apply extra validation rules.

time the new time

QLocale::FormatType KTimeComboBox::displayFormat() const

Return the currently set time format

By default this is the Short Format

See also setDisplayFormat()

bool KTimeComboBox::isNull() const

Return if the current user input is null

See also isValid()

bool KTimeComboBox::isValid() const

Return if the current user input is valid

If the user input is null then it is not valid

See also isNull()

QTime KTimeComboBox::maximumTime() const

Return the current maximum time

Note: Getter function for property maximumTime.

See also setMaximumTime()

QTime KTimeComboBox::minimumTime() const

Return the current minimum time

Note: Getter function for property minimumTime.

See also setMinimumTime()

KTimeComboBox::Options KTimeComboBox::options() const

Return the currently set widget options

Note: Getter function for property options.

See also setOptions()

void KTimeComboBox::resetMaximumTime()

Reset the maximum time to the default of 23:59:59.999

Note: Resetter function for property maximumTime.

void KTimeComboBox::resetMinimumTime()

Reset the minimum time to the default of 00:00:00.000

Note: Resetter function for property minimumTime.

void KTimeComboBox::resetTimeRange()

Reset the minimum and maximum time to the default values.

[slot] void KTimeComboBox::setDisplayFormat(QLocale::FormatType format)

Sets the time format to display.

By default is the Short Format.

format the time format to use

See also displayFormat()

[slot] void KTimeComboBox::setMaximumTime(const QTime &maxTime, const QString &maxWarnMsg = QString())

Set the maximum allowed time.

If the time is invalid, or less than current minimum, then the maximum will not be set.

maxTime the maximum time

maxWarnMsg the maximum warning message

Note: Setter function for property maximumTime.

See also minimumTime(), maximumTime(), setMaximumTime(), setTimeRange()

[slot] void KTimeComboBox::setMinimumTime(const QTime &minTime, const QString &minWarnMsg = QString())

Set the minimum allowed time.

If the time is invalid, or greater than current maximum, then the minimum will not be set.

minTime the minimum time

minWarnMsg the minimum warning message

Note: Setter function for property minimumTime.

See also minimumTime(), maximumTime(), setMaximumTime(), setTimeRange()

[slot] void KTimeComboBox::setOptions(KTimeComboBox::Options options)

Set the new widget options

options the new widget options

Note: Setter function for property options.

See also options()

[slot] void KTimeComboBox::setTime(const QTime &time)

Set the currently selected time

You can set an invalid time or a time outside the valid range, validity checking is only done via isValid().

time the new time

Note: Setter function for property time.

See also time()

[slot] void KTimeComboBox::setTimeList(QList<QTime> timeList, const QString &minWarnMsg = QString(), const QString &maxWarnMsg = QString())

Set the list of times able to be selected from the drop-down.

Setting the time list will override any time interval previously set via setTimeListInterval().

Any invalid or duplicate times will be ignored, and the list will be sorted.

The minimum and maximum time will automatically be set to the earliest and latest value in the list.

timeList the list of times able to be selected

minWarnMsg the minimum warning message

maxWarnMsg the maximum warning message

See also timeList()

[slot] void KTimeComboBox::setTimeListInterval(int minutes)

Set the interval between times able to be selected from the drop-down.

The combo drop-down will be populated with times every minutes apart, starting from the minimumTime() and ending at maximumTime().

If the ForceInterval option is set then any time manually typed into the combo line edit will be forced to the nearest interval.

This interval must be an exact divisor of the valid time range hours. For example with the default 24 hour range interval must divide 1440 minutes exactly, meaning 1, 6 and 90 are valid but 7, 31 and 91 are not.

Setting the time list interval will override any time list previously set via setTimeList().

minutes the time list interval to display

Note: Setter function for property timeListInterval.

See also timeListInterval()

void KTimeComboBox::setTimeRange(const QTime &minTime, const QTime &maxTime, const QString &minWarnMsg = QString(), const QString &maxWarnMsg = QString())

Set the minimum and maximum time range.

If either time is invalid, or min > max then the range will not be set.

minTime the minimum time

maxTime the maximum time

minWarnMsg the minimum warning message

maxWarnMsg the maximum warning message

QTime KTimeComboBox::time() const

Return the currently selected time

Note: Getter function for property time.

See also setTime()

[signal] void KTimeComboBox::timeChanged(const QTime &time)

Signal if the time has been changed either manually by the user or programmatically.

The returned time may be invalid.

time the new time

Note: Notifier signal for property time.

[signal] void KTimeComboBox::timeEdited(const QTime &time)

Signal if the time is being manually edited by the user.

The returned time may be invalid.

time the new time

[signal] void KTimeComboBox::timeEntered(const QTime &time)

Signal if the time has been manually entered or selected by the user.

The returned time may be invalid.

time the new time

QList<QTime> KTimeComboBox::timeList() const

Return the list of times able to be selected in the drop-down.

See also setTimeList(), timeListInterval(), setTimeListInterval()

int KTimeComboBox::timeListInterval() const

Return the interval in minutes between select time list entries if set by setTimeListInterval().

Returns -1 if not set.

Note: Getter function for property timeListInterval.

See also setTimeListInterval()

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.