Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Wiki Markup
{alias:qinsertitem}

Name

qinsertitem — insert item in a QComboBox

...

The qinsertitem command inserts items in a QComboBox 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

...

No Format
bgColor#eeeeee
borderWidth1

# 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.