Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. ComboBox model order
Qt 6.11 is out! See what's new in the release blog

ComboBox model order

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 332 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    joaogatao
    wrote on last edited by
    #1

    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!

    1 Reply Last reply
    0
    • J Offline
      J Offline
      joaogatao
      wrote on last edited by
      #2

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

      import QtQuick.Controls 2.15
      
      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved