I have a QComboBox
with a QSqlQueryModel
as its model. The model is constructed from a database with
SELECT type_id, type FROM types
where type_id
is int
and type is a varchar
.
I set the QComboBox
visible column with the setModelColumn(1)
function, to see the actual types, instead of the indexes, but when a value is selected, I need to retrieve the type_id
and I don't know how to achieve that. I can't use here the currentIndex()
function, because the current index of the QComboBox
is useless for me.
I think the correct function is the currentData()
, but I can't figure it out, how to get the data from the first column...