[PyQt] qsqlquerymodel combobox items cleared

Linos info at linos.es
Mon Nov 26 16:50:16 GMT 2007


Hello all,
	inside a dialog i populate the contents of a query in three comboboxes like this:

self.subfamiliaModel = QSqlQueryModel()
self.subfamiliaComboBox.setModel(self.subfamiliaModel)
self.subfamiliaModel.setQuery("SELECT SUBFAMILIA_ID & ' ' & NOMBRE FROM SCHEMA.MODELO_SUBFAMILIA ORDER BY
EXPRESSION1", maxdb)
self.subfamiliaComboBox.setCurrentIndex(-1)

every combobox have his own model, this works well, it is a dialog that can be used many times because it is
to search for items codes so i dont create it every time i load the dialog, instead i maintain in memory and
in every exec i clear the filters of the lineedit and selections in comboboxes, i use 4 lineedits and 3
comboboxes but one of the comboboxes it is reloaded on every .exec_() to the dialog because his query and
contents is changed while editing the other comboboxes. well all works very well but if a leave the program
open any time (about 20 minutes) and exec the dialog, the two comboboxes with qsqlquerymodel that are not
resetted in every load are empty. do qsqlquerymodel any timeout or anything alike? i cant find in documentation.

Best Regards,
Miguel Angel.


More information about the PyQt mailing list