[SOLVED]QtQuick Combobox reset list index not working

  • Hi,

    I'm trying to sort simple problem to clear qtquick combobox from selected item in documention i read it should be done via set currentindex to -1 but its only clear selection in the list but text in combo still rest the same is there any way to clear it?

    Example below.

    Thanks for any advice.

    @import QtQuick 2.1
    import QtQuick.Controls 1.1
    import QtQuick.Window 2.0

    ApplicationWindow {
    title: qsTr("Hello World")
    width: 640
    height: 480

        anchors.horizontalCenter: parent.horizontalCenter
        anchors.verticalCenter: parent.verticalCenter
            id: cbo_Test
            model: ["AAA","BBB","CCC"]
        Button {
            text: qsTr("Clear Selection")
            onClicked: {
                cbo_Test.currentIndex = -1


  • Moderators


    Do you mean that you want to show the first item after clicking the button ?

  • Hi,

    after click on the button there should be nothing selected in the combo. it's set index to -1 but combo text is still showing item from first positon index 0

  • Moderators

    Your code works fine on my system.
    But I'm using Qt 5.2.1.
    Which Qt version are you using ?

  • Moderators


    It seems to be bug in Qt 5.2.0. It is solved in Qt 5.2.1
    See "this":https://bugreports.qt-project.org/browse/QTBUG-35794

  • Hi p3c0,

    yes i was using version Qt 5.2.0 now upgraded to Qt 5.2.1 and it works fine.

    Thank you for your help.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.