[Solved]QModelIndex get data

  • Hi all

    I have a QListView with its model set with QSqlQueryModel object.

    The QSqlQueryModel contains a table with two columns (id and name), the QListView is set to show the name

    I have connected the QListView with the signal clicked(), the slot receives a QModelIndex object. How do I get the id from the QSqlQueryModel from the QModelIndex ?


  • Just get the sibling on the same row and on the id column. Give a look to QModelIndex methods.

  • Thanks peppe, that did the trick.

Log in to reply

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