qinsertitem - insert item in a QComboBox

Name

qinsertitem — insert item in a QComboBox

Syntax

qinsertitem combo index item

qinsertitem combo index icon item

Description

The qinsertitem command inserts items in a qcombobox.

Arguments

combobox

The target QComboBox. This argument is required.

index

The position in the existing item list into which the new item will be inserted (Indexing starts at 0).

item

Item value to be inserted in the combobox. This is usually a string or a number, although any Tcl variable that can be converted to a string can be used.

icon

An instance of a QIcon. If this argument is provided an icon will appear alongside the item.

Examples

Ex.1: qinsertitem

# Some files containing pixmaps
set fileopen_icon_file [file join $Geocap::geocapdir icons fileopen.xpm]

# Create icons
set fileopen_icon [qicon $fileopen_icon_file]

set w [qwidget ]
qsetwindowtitle "ABC Combo"
qvboxlayout {
	set c [qcombobox]
	qadditems { A B C }
	qinsertitem $c 1 INSERTED
	qinsertitem $c 2 $fileopen_icon FILEOPEN
}

qshow $w

The above example inserts two items, one includes an icon. Both are in a combobox.

Â