Class WComboBox

Direct Known Subclasses:

public class WComboBox
extends WFormWidget
A widget that provides a drop-down combo-box control.

A combo box provides the user with a set of options, from which one option may be selected.

WComboBox is an MVC view class, using a simple string list model by default. The model may be populated using addItem() or insertItem() and the contents can be cleared through clear(). These methods manipulate the underlying getModel().

To use the combo box with a custom model instead of the default WStringListModel, use setModel().

To react to selection events, connect to the WFormWidget.changed(), activated() or sactivated() signals.

At all times, the current selection index is available through getCurrentIndex() and the current selection text using getCurrentText().

WComboBox does not have support for auto-completion, this behaviour can be found in the WSuggestionPopup.

WComboBox is an inline widget.


The widget corresponds to the HTML <select> tag and does not provide styling. It can be styled using inline or external CSS as appropriate.