Answer the question
In order to leave comments, you need to log in
SQLRelationTableModel foreign key to own PK?
Hello.
I use qt + sqlite. I created the Sensors table in it with a foreign key pointing to the same table (to the primary key). I need each Sensor instance to have information about another Sensor for temperature compensation. I create QSqlRelation for foreign key
int idSensorFK = m_sensors_model->fieldIndex("FK_Termocomp");
m_sensors_model->setRelation(idSensorFK, QSqlRelation("Sensors", "idSensor", "SensorName"));
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question