Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

...

Name

qinsertitem — insert item in a QComboBox

Syntax

Panel
bgColor#FFFFAA
borderWidth1
borderStylesolid

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

Anchor
qinsertitem
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

{noformat}

!att:_img_cmd^qinsertitem.png!

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

{pagebreak}

Image Added

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