Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/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:
    0_1563048001720_2a2d9b5a-1251-4ee7-87c8-1f77aa764816-image.png

    and I want to keep The Friend is a .... text on top.
    After sorting:
    0_1563048073176_d646fa37-4bf5-4ee8-92e1-545028ff977b-image.png

    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