Important: Please read the Qt Code of Conduct -

Assigning index 0 to an item in an SQLite db table field

  • Hi,
    I have a ComboBox which is populated from an SQLite db. I use the first item in the column as a "placeholder text" so it should stay index 0 to display the right text. The original (unsorted) list looks like this:

    and I want to keep The Friend is a .... text on top.
    After sorting:

    SO how can I sort everything but also keep The Friend is a .... index on the top?
    Thank you for your help.

  • @gabor53
    To do your sorting are you interposing a QSortFilterProxyModel as the model between the QComboBox and your QSqlQuery/TableModel for your database?

    And/or/also, how are using "the first item in the column as a "placeholder"? Does it come back as a row from the database, do you insert it somewhere, how/what?

Log in to reply