PDA

View Full Version : QComboBox popup



aekilic
5th January 2009, 23:36
Dear all

I have a QCombobox that brings its data from QSqlQueryModel,

What I need to do is, everytime i requested for a pop up I need the combo clears its data and repeate QSqlQueryModel

wysota
5th January 2009, 23:59
Reimplement QComboBox::showPopup() and execute the model's query again there.

spirit
6th January 2009, 06:42
searching by forum still works QComboBox & database (http://www.qtcentre.org/forum/f-newbie-4/t-bind-a-qcombobox-to-a-database-15426.html/?highlight=QComboBox)

aekilic
6th January 2009, 08:51
Dear all

We could all ready use QSqlModel for the combo, and we dont have problem with it.

But the problem is, we have a main window that has combos, which is updates from other widgets.

What we would like to do is, everytime we request for a pop up, we need to delete the datas in the combo, and re SELECT from the database again, and fill the combo.

We were not able to find a signal for that.

Please help...

spirit
6th January 2009, 09:07
you can use the same model in comboboxes and in another views. so, if you change this model then all views will be updated automatically and comboboxes also. I don't see any problem :)

aekilic
6th January 2009, 09:25
No the thing is,

The model in the main page is change by the other widget, so we need to change it.

spirit
6th January 2009, 09:34
I don't understand the problem in this case.
why you can't set that model to needed combobox? :confused:


...
m_comboBox->setModel(m_mySqlModel);
...

aekilic
6th January 2009, 10:00
Dear Spirit

We could set the model, but i could not find a signal for combo

like connect(combo... clicked signal setxmodel)

we need a connect like

showpopup

and then set model again...

spirit
6th January 2009, 10:05
so, you just need show popup, right?
try to handle this signal QAbstractItemModel::dataChanged

wysota
6th January 2009, 10:24
What we would like to do is, everytime we request for a pop up, we need to delete the datas in the combo, and re SELECT from the database again, and fill the combo.
Why don't you follow my suggestion?


We were not able to find a signal for that.

You can't do everything by using signals.