PDA

View Full Version : QComboBox??



crocus
6th February 2006, 14:50
Thread close.

zlatko
7th February 2006, 09:56
Just moment for a future:
I think if you find solution for your problem you can post it here instead of replace question on "Thread closed" ;) It help other people solve a similar problem fastets!

crocus
8th February 2006, 15:57
К сожалению я совсем не говорю по-английски и очень плохо пишу:(
Суть вопроса свелась к алгоритму продемонстрированному в /demos/books т.е. использовался фильтр, я же пытался применить QSqlQueryModel,
для QSqlRelationalTableModel используется

cdi.comboStreet->setCurrentIndex(cdi.comboStreet->findText(rec.value(streetIdx).toString()));
я же для QSqlQueryModel делал так:

cdi.comboStreet->setCurrentIndex(cdi.comboStreet->findText(rec.value("street_cod").toString()));
И соответственно не получал необходимого результата( and don,t work).
Вот так работает:

QModelIndex currentIndex = modelFlats->index(0, streetIdx);
if (modelFlats->data(currentIndex).toString() != text)
modelFlats->setData(currentIndex, cdi.comboStreet->currentText());
QString cod = cdi.comboStreet->currentText();
QString queryStreet = ("UPDATE tbl_flats,tbl_street SET tbl_flats.street_cod = tbl_street.street_cod WHERE tbl_street.street_name = '"
+ cod + "' And tbl_flats.flats_cod = " + flatcod + " ;");
modelQuery->setQuery(queryStreet);

GreyGeek
8th February 2006, 19:00
I KNEW there was a reason why I needed BableFish! ;)