Qt Components Hildon  0.20
QML components for Maemo5 with Hildon styling.
 All Classes Functions Properties Groups Pages
Signals | Public Member Functions | Properties | List of all members
ComboBox Class Reference

Provides a drop-down list functionality. More...

Signals

void selected (string text)
 Emitted when the user selects an item in the combo box.

Public Member Functions

int findText (string text)
 Finds and returns the index of a given text.
bool insertItem (int index, string text)
 Inserts text at the specified index.
bool insertItems (int index, stringlist list)
 Inserts list at the specified index.
bool removeItem (int index)
 Removes the item at index.
bool replaceItem (int index, string text)
 Replaces the item at index with text.
string textAt (int index)
 Returns the text for a given index.

Properties

int count
 The number of items in the combo box.
int currentIndex
 The index of the currently selected item in the combo box.
string currentValueText
 The text of the currently selected item in the combo box.
bool editable
 Whether the combo box can be edited by the user.
string editText
 The text being manipulated by the user for an editable combo box.
enumeration insertPolicy
 The policy used to determine how new strings should be inserted in an editable combo box.
int maximumCount
 The maximum number of items allowed in the combo box.
variant model
 The model to populate the combo box from.
ComboBoxStyle style
 Used to provide styling properties for the combo box.
string textRole
 The model role used for displaying text the combo box items.
Validator validator
 The text validator for an editable combo box.

Detailed Description

Provides a drop-down list functionality.

import QtQuick 1.0
import org.hildon.components 1.0
Window {
id: window
title: qsTr("ComboBox Example")
visible: true
Column {
id: column
anchors.centerIn: parent
width: 300
width: parent.width
model: [1, 2, 3, 4, 5]
}
width: parent.width
model: [1, 2, 3, 4, 5]
editable: true
}
}
}
See Also
ComboBoxStyle, OssoComboBoxStyle
Examples:
combobox.qml.

Member Function Documentation

int ComboBox::findText ( string  text)

Finds and returns the index of a given text.

Parameters
text
Returns

If no match is found, -1 is returned. The search is case sensitive.

bool ComboBox::insertItem ( int  index,
string  text 
)

Inserts text at the specified index.

Parameters
index
text
Returns

Returns true if text is successfully inserted.

See Also
insertItems()
bool ComboBox::insertItems ( int  index,
stringlist  list 
)

Inserts list at the specified index.

Parameters
index
list
Returns

Returns true if list is successfully inserted.

See Also
insertItem()
bool ComboBox::removeItem ( int  index)

Removes the item at index.

Parameters
index
Returns

Returns true if the item is successfully removed.

bool ComboBox::replaceItem ( int  index,
string  text 
)

Replaces the item at index with text.

Parameters
index
text
Returns

Returns true if the item is successfully replaced.

string ComboBox::textAt ( int  index)

Returns the text for a given index.

Parameters
index
Returns

If an invalid index is provided, null is returned

Property Documentation

bool ComboBox::editable

Whether the combo box can be edited by the user.

The default value is false.

enumeration ComboBox::insertPolicy

The policy used to determine how new strings should be inserted in an editable combo box.

The possible values are:

Name Description
InsertPolicy.NoInsert The string will not be inserted.
InsertPolicy.InsertAtTop The string will be inserted as the first item.
InsertPolicy.InsertAtCurrent The current item will be replaced.
InsertPolicy.InsertAtBottom The string will be inserted after the last item (default).
InsertPolicy.InsertAfterCurrent The string will be inserted after the current item.
InsertPolicy.InsertBeforeCurrent The string will be inserted before the current item.
InsertPolicy.InsertAlphabetically The string will be inserted in alphabetic order.
int ComboBox::maximumCount

The maximum number of items allowed in the combo box.

The default value is Number.MAX_VALUE.

variant ComboBox::model

The model to populate the combo box from.

The default model is an empty array.