Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

ComboBox model order



  • Hi, I have a simple combo box with a list of strings as model. But I see that the model order gets automatically sorted alphabetically in the app, which flips around all the indeces. Using a ListModel results in the same.
    How to keep the order and indeces just as in the model list?

    ComboBox{
        id: combo
        model: ["Kick", "Tom", "Snare", "Hihat"]
        onCurrentIndexChanged: sounds[drum] = combo.currentIndex 
    }
    

    In the app the drop down menu shows: Kick | Hihat | Snare | Tom. So the text doesn't match the index as intended anymore.

    Thanks!



  • Ok, using the latest Qt Quick controls version seems to have solved it.

    import QtQuick.Controls 2.15
    

Log in to reply