Versions Compared

Key

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

*qinsertitem* — insert item in a QComboBox

h2. Syntax
{panel:|borderStyle=solid|borderWidth=1|bgColor=#FFFFAA}

*qinsertitem* _combo index item_ 

*qinsertitem* _combo index icon item_ 

{panel}

h2. Description

The *qinsertitem* command inserts items in a [QComboBox]. 

h2. Arguments

_combobox_
{indent}The target QComboBox. This argument is required. 
{indent}
_index_
{indent}The position in the existing item list into which the new item will be inserted (Indexing starts at 0). 
{indent}
_item_
{indent}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. 
{indent}
_icon_ 
{indent}An instance of a QIcon. If this argument is provided an icon will appear alongside the item. 
{indent} 

h2. Examples

h3. Ex.1: qinsertitem
{anchor:qinsertitem}

{noformat:|borderWidth=1|bgColor=#eeeeee}
# 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}