KTimeZoneWidget

KDE 4.7 PyKDE API Reference

- KDE's Python API

# KTimeZoneWidget Class Reference

`from PyKDE4.kdeui import *`

Inherits: QTreeWidget → QTreeView → QAbstractItemView → QAbstractScrollArea → QFrame → QWidget → QObject

## Detailed Description

A time zone selection widget.

Detail:

This class provides for selection of one or more time zones.

Example:

To use the class to implement a system timezone selection feature:

      // This adds a time zone widget to a dialog.
      m_timezones = new KTimeZoneWidget(this);
      ...

To use the class to implement a multiple-choice custom time zone selector:

      m_timezones = new KTimeZoneWidget( this, "Time zones", vcalendarTimezones );
      m_timezones->setSelectionMode( QTreeView.MultiSelection );
      ...

"KDE Time Zone Widget"

Author:
  S.R.Haque <srhaque@iee.org>

## Methods
| __init__ (self, QWidget parent=0, KTimeZones timeZones=0)
| clearSelection (self)
bool | itemsCheckable (self)
QStringList | selection (self)
QAbstractItemView::SelectionMode | selectionMode (self)
| setItemsCheckable (self, bool enable)
| setSelected (self, QString zone, bool selected)
| setSelectionMode (self, QAbstractItemView::SelectionMode mode)
## Static Methods
QString | displayName (KTimeZone zone)

## Method Documentation

__init__ | ( | self, |
|  | QWidget | parent=0,
|  | KTimeZones | timeZones=0
| ) |  |  |

Constructs a time zone selection widget.

Parameters:

  | parent | The parent widget.
  | timeZones | The time zone database to use. If 0, the system time zone database is used.

clearSelection | ( |  | self ) |

Unselect all timezones. This is the same as QTreeWidget.clearSelection, except in checkable items mode, where items are all unchecked. The overload is

Since:
  4.4.

bool itemsCheckable | ( |  | self ) |

Returns:
  true if setItemsCheckable(true) was called.

Since:
  4.4

QStringList selection | ( |  | self ) |

Returns the currently selected time zones. See QTreeView.selectionChanged().

Returns:
  a list of time zone names, in the format used by the database supplied to the {@link KTimeZoneWidget() } constructor.

QAbstractItemView::SelectionMode selectionMode | ( |  | self ) |

Returns:
  the selection mode set by setSelectionMode().

Since:
  4.4

setItemsCheckable | ( | self, |
|  | bool | enable
| ) |  |  |

Makes all items show a checkbox, so that the user can select multiple timezones by means of checking checkboxes, rather than via multi-selection.

In "items checkable" mode, the selection(), setSelected() and clearSelection() methods work on the check states rather than on selecting/unselecting.

Since:
  4.4

setSelected | ( | self, |
|  | QString | zone,
|  | bool | selected
| ) |  |  |

Select/deselect the named time zone.

Parameters:

  | zone | The time zone name to be selected. Ignored if not recognized!
  | selected | The new selection state.

setSelectionMode | ( | self, |
|  | QAbstractItemView::SelectionMode | mode
| ) |  |  |

Allows to select multiple timezones. This is the same as setSelectionMode(KTimeZoneWidget.MultiSelection) normally, but in "items checkable" mode, this is rather about allowing to check multiple items. In that case, the actual QTreeWidget selection mode remains unchanged.

Since:
  4.4

## Static Method Documentation

QString displayName | ( | KTimeZone | zone
| ) |  |  |

Format a time zone name in a standardised manner. The returned value is transformed via an i18n lookup, so the caller should previously have set the time zone catalog:

       KGlobal.locale()->insertCatalog( "timezones4" );

Returns:
  formatted time zone name.