[PyQt] QDataWidgetMapper

Sibylle Koczian Sibylle.Koczian at t-online.de
Tue Nov 27 19:02:51 GMT 2007


Am Montag, 26. November 2007 13:59:52 schrieb Daniel Lundqvist:
> Hey,
>
> I've been struggling to get the above to work correctly. I've looked
> around but haven't found a solution to my problem yet.
>
> The issue I'm having is I can't get the mapper to update the widgets at
> all. Not even when I call setCurrentIndex(n).
>
> I'm attaching my sample project that shows the problem. The sample
> contains a simple model with two columns. One combo box show column 0
> from the model and a QLineEdit should show second column from the index
> selected in the combo box. (I've also tried connecting
> QComboBox::activated(int) -> QDataWidgetMapper::setCurrentIndex(int) to
> no avail).
>

I'm just playing with the QDataWidgetMapper myself, so I looked at your 
project and tried some changes. Changing the model to a QStandardItemModel, 
QSqlQueryModel, QSqlTableModel (with a SQLite memory "database") didn't help. 
But if I take the combobox out, then the QLineEdit shows content.

In my own project I've got a main window containing a QTableView and a QDialog 
containing only QLineEdit controls using a QDataWidgetMapper. That works.

Could it be that you can't mix controls using a model directly and controls 
using a QDataWidgetMapper in the same window? Looks very strange.

Just replacing one riddle by a new one, I'm afraid.

-- 
Dr. Sibylle Koczian


More information about the PyQt mailing list