Sailfish OS
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS
Select Page
  • Info
  • User Experience
  • Cases
  • Community
  • Developers
  • Contact
  • Get Sailfish OS

API Documentation

Documentation for developing SailfishOS applications
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon
  • API Documentation
  • Libsailfishapp
  • Sailfish Silica
    • Documentation
    • Icon Reference
  • Sailfish Components
    • Sailfish Accounts
    • Sailfish Bluetooth
    • Sailfish Contacts
    • Sailfish Crypto
    • Sailfish Gallery
    • Sailfish Media
    • Sailfish Pickers
    • Sailfish Secrets
    • Sailfish Share
    • Sailfish Telephony
    • Sailfish Webview
    • Amber Web Authorization
    • Amber MPRIS
  • Nemo QML Plugins
    • Configuration
    • Contacts
    • D-Bus
    • Keepalive
    • Notifications
    • Thumbnailer
  • Sailfish Middleware
    • MDM Framework
    • MDM Policy Framework
    • User Manager Daemon

Contents

  • Properties
  • Detailed Description

ComboBox QML Type

A combo box control for selecting from a list of options More...

Import Statement: import Sailfish.Silica 1.0
Inherits:

ValueButton

  • List of all members, including inherited members

Properties

  • currentIndex : int
  • currentItem : Item
  • description : string
  • label : string
  • menu : Item
  • value : string

Detailed Description

The ComboBox type provides a label with an attached menu to enable the user to select a value from a list of options.

A combo box displays a label together with a value. When the label or value is clicked, a context menu appears with a list of options, allowing the user to select a new value from this list. This context menu may be specified through the menu property.

Below is a simple combo box:

 import QtQuick 2.2
 import Sailfish.Silica 1.0

 ComboBox {
     width: 480
     label: "Screen brightness"

     menu: ContextMenu {
         MenuItem { text: "automatic" }
         MenuItem { text: "manual" }
         MenuItem { text: "high" }
     }
 }

The "Screen brightness:" label is displayed together with the value "automatic". When the label or value is clicked, the supplied menu appears, highlighting the currently selected option. When a menu item is clicked, the menu closes and the value updates to the new selection.

Notice the value property defaults to the text of the currently selected option. In the above example, the current selection defaults to the first item in the menu because neither currentIndex nor currentItem have been set.

See also BackgroundItem.

Property Documentation

currentIndex : int

The index of the item currently selected in the menu. This value defaults to 0.

Changing this value automatically updates the currentItem to refer to the item at this index. Setting this to an index outside of the range of options in the menu will clear the current selection, setting currentIndex to -1 and currentItem to null.

If both currentIndex and currentItem are initially set, the currentItem value takes precedence.

See also currentItem.


currentItem : Item

The item currently selected in the menu. If currentIndex is set to a valid index, this defaults to the item referred to by currentIndex; otherwise, this defaults to null.

Changing this value automatically updates the currentIndex to refer to the index of this item. Setting this to null or an item with a false value for enabled will clear the current selection, setting currentItem to null and currentIndex to -1.

If both currentIndex and currentItem are initially set, the currentItem value takes precedence.

See also currentIndex.


description : string

Optional text to describe the purpose of the combox box.


label : string

A concise description of the type of data options presented by the menu.

See also value.


menu : Item

The context menu that is displayed when the displayed label or value is clicked.


value : string

The text of the currently selected menu option, as specified by currentIndex or currentItem.

See also label.


  • Legal
  • Contact Us
  • Jolla Mobile Ltd © 2025

  • Facebook
  • Twitter
  • Mastodon
  • YouTube
  • LinkedIn