QComboBox Class Reference


The QComboBox widget is a combined button and popup list. (details) (complete member list)

#include <qcombo.h>

Inherits QWidget.

Public Members

Signals

Protected Members


Detailed Description

The QComboBox widget is a combined button and popup list.

A combo box is a kind of popup menu that is opened by pressing a button. The popup list contains a number of string/pixmap items. The button displays the current item when the popup list is closed.

A combo box emits two signals, activated() and highlighted(), when a new item has been activated (selected) or highlighted (set to current).


Member Function Documentation

QComboBox::QComboBox (QWidget *parent=0, const char *name=0)

Constructs a combo box widget with a parent and a name.

QComboBox::~QComboBox ()

Destroys the combo box.

void QComboBox::activated (int index)

This signal is emitted when a new item has been activated (selected). The index is the position of the item in the popup list.

void QComboBox::adjustSize ()

Adjusts the size of the combo box button to fit the contents.

This function is called automatically whenever the current item change and auto-resizing is enabled.

See also: setAutoResizing().

bool QComboBox::autoResizing () const

Returns TRUE if auto-resizing is enabled, or FALSE if auto-resizing is disabled.

Auto-resizing is disabled by default.

See also: setAutoResizing().

void QComboBox::changeItem (const char *string, int index)

Replaces the item at position index with a string.

void QComboBox::changeItem (const QPixmap &im, int index)

Replaces the item at position index with a pixmap.

void QComboBox::clear ()

Removes all combo box items.

int QComboBox::count () const

Returns the number of items in the combo box.

void QComboBox::currentChanged ()

.

void QComboBox::highlighted (int index)

This signal is emitted when a new item has been set to current. The index is the position of the item in the popup list.

void QComboBox::insertItem (const char *string, int index=-1)

Inserts a string item at position index. The item will be appended if index is negative.

void QComboBox::insertItem (const QPixmap &pixmap, int index=-1)

Inserts a pixmap item at position index. The item will be appended if index is negative.

void QComboBox::internalActivate (int index)

.

void QComboBox::internalHighlight (int index)

.

QPixmap * QComboBox::pixmap (int index) const

Returns the pixmap item at a given index, or 0 if the item is not a pixmap.

void QComboBox::popup ()

Popups the combo box popup list.

void QComboBox::reIndex ()

.

void QComboBox::removeItem (int index)

Removes the item at position index.

void QComboBox::setAutoResizing (bool enable)

Enables auto-resizing if enable is TRUE, or disables it if enable is FALSE.

When auto-resizing is enabled, the combo box button will resize itself whenever the current combo box item change.

See also: autoResizing() and adjustSize().

void QComboBox::setBackgroundColor (const QColor &color)

Reimplements the virtual function QWidget::setBackgroundColor().

Sets the background color for both the combo box button and the combo box popup list.

void QComboBox::setCurrentItem (int index)

Sets current item, i.e. the item to be displayed on the combo box button.

void QComboBox::setFont (const QFont &font)

Reimplementes the virtual function QWidget::setFont().

Sets the font for both the combo box button and the combo box popup list.

void QComboBox::setPalette (const QPalette &palette)

Reimplementes the virtual function QWidget::setPalette().

Sets the palette for both the combo box button and the combo box popup list.

void QComboBox::setStrList (const QStrList *list)

Sets the contents of the combo box to the list of strings list.

void QComboBox::setStrList (const char **strs, int numStrings=-1)

Sets the contents of the combo box to the array of strings strs.

The numStrings argument is the number of strings. If numStrings is -1 (default), the strs array must be terminated with 0.

Example of use:

  static const char *items[] = { "red", "green", "blue", 0 };
  combo->setStrList( items );

const char * QComboBox::string (int index) const

Returns the string item at a given index, or 0 if the item is not a string.


This file is part of the Qt toolkit, copyright 1995 Troll Tech, all rights reserved.

It was generated from the following files:


Generated at 16:17, 1995/06/30 by the webmaster at Troll Tech