Plasma.ComboBox

KDE 4.9 PyKDE API Reference

- KDE's Python API

# ComboBox Class Reference

`from PyKDE4.plasma import *`

Inherits: QGraphicsProxyWidget → QGraphicsWidget → QObject
Namespace: Plasma

## Detailed Description

ComboBox plasma/widgets/combobox.h <Plasma/Widgets/ComboBox>

Provides a Plasma-themed combo box.

## Signals
| activated (QString text)
| currentIndexChanged (int index)
| textChanged (QString text)
## Methods
| __init__ (self, QGraphicsWidget parent=0)
| addItem (self, QString text)
| changeEvent (self, QEvent event)
| clear (self)
int | count (self)
int | currentIndex (self)
| focusInEvent (self, QFocusEvent event)
| focusOutEvent (self, QFocusEvent event)
| hoverEnterEvent (self, QGraphicsSceneHoverEvent event)
| hoverLeaveEvent (self, QGraphicsSceneHoverEvent event)
| mousePressEvent (self, QGraphicsSceneMouseEvent event)
KComboBox | nativeWidget (self)
| paint (self, QPainter painter, QStyleOptionGraphicsItem option, QWidget widget)
| resizeEvent (self, QGraphicsSceneResizeEvent event)
| setCurrentIndex (self, int index)
| setNativeWidget (self, KComboBox nativeWidget)
| setStyleSheet (self, QString stylesheet)
QString | styleSheet (self)
QString | text (self)

## Signal Documentation

activated | ( | QString | text
| ) |  |  |

This signal is sent when the user chooses an item in the combobox. The item's text is passed.

Signal syntax:
  `QObject.connect(source, SIGNAL("activated(const QString&)"), target_slot)`

currentIndexChanged | ( | int | index
| ) |  |  |

This signal is sent whenever the currentIndex in the combobox changes either through user interaction or programmatically.

Signal syntax:
  `QObject.connect(source, SIGNAL("currentIndexChanged(int)"), target_slot)`

textChanged | ( | QString | text
| ) |  |  |

This signal is sent whenever the currentIndex in the combobox changes either through user interaction or programmatically. The item's text is passed.

Signal syntax:
  `QObject.connect(source, SIGNAL("textChanged(const QString&)"), target_slot)`

## Method Documentation

__init__ | ( | self, |
|  | QGraphicsWidget | parent=0
| ) |  |  |

addItem | ( | self, |
|  | QString | text
| ) |  |  |

Adds an item to the combo box with the given text. The item is appended to the list of existing items.

changeEvent | ( | self, |
|  | QEvent | event
| ) |  |  |

clear | ( |  | self ) |

int count | ( |  | self ) |

Returns the number of items in the combo box

Since:
  4.6

int currentIndex | ( |  | self ) |

Returns the current index of the combobox

Since:
  4.6

focusInEvent | ( | self, |
|  | QFocusEvent | event
| ) |  |  |

focusOutEvent | ( | self, |
|  | QFocusEvent | event
| ) |  |  |

hoverEnterEvent | ( | self, |
|  | QGraphicsSceneHoverEvent | event
| ) |  |  |

hoverLeaveEvent | ( | self, |
|  | QGraphicsSceneHoverEvent | event
| ) |  |  |

mousePressEvent | ( | self, |
|  | QGraphicsSceneMouseEvent | event
| ) |  |  |

KComboBox nativeWidget | ( |  | self ) |

Returns:
  the native widget wrapped by this ComboBox

paint | ( | self, |
|  | QPainter | painter,
|  | QStyleOptionGraphicsItem | option,
|  | QWidget | widget
| ) |  |  |

resizeEvent | ( | self, |
|  | QGraphicsSceneResizeEvent | event
| ) |  |  |

setCurrentIndex | ( | self, |
|  | int | index
| ) |  |  |

Sets the current index of the combobox

Since:
  4.6

setNativeWidget | ( | self, |
|  | KComboBox | nativeWidget
| ) |  |  |

Sets the combo box wrapped by this ComboBox (widget must inherit KComboBox), ownership is transferred to the ComboBox

Parameters:

  | nativeWidget | combo box that will be wrapped by this ComboBox

Since:
  KDE4.4

setStyleSheet | ( | self, |
|  | QString | stylesheet
| ) |  |  |

Sets the stylesheet used to control the visual display of this ComboBox

Parameters:

  | stylesheet | a CSS string

QString styleSheet | ( |  | self ) |

Returns:
  the stylesheet currently used with this widget

QString text | ( |  | self ) |

Returns:
  the display text