Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, January 2007
QDataWidgetMapper: data not visible in mapped widgets


Message 1 in thread

 I am trying a very simple piece of code i got from the documentation but i am not able to see the data from my sql table, in the widgets that are mapped. The code is as follows: QSqlTableModel *model = new QSqlTableModel(this);model->setTable("user_info");QDataWidgetMapper *mapper = new QDataWidgetMapper();mapper->setModel(model);mapper->addMapping(comboBox, 0);mapper->addMapping(lineEdit_2, 1);mapper->addMapping(lineEdit_3, 2);mapper->addMapping(lineEdit_4, 3);mapper->addMapping(lineEdit_5, 4);connect(pushButton,SIGNAL(clicked()),mapper,SLOT(toNext())); I created a form with the widgets above (lineEdit, combobox ect) and created a class which inherits the form class, what i have above is an extract form the constructor for my derived class. But when the program runs i see nothing in the widgets. 
 
I tested the mapping using 
int QDataWidgetMapper::mappedSection ( QWidget * widget ) const
 
and used a qmessage box to output the return value that indicates that the widget was mapped to a particular section, and the mapping seem to be successful, but there is nothing being displayed in the widgets.
 
I saw in the archive where someone else was having problems with it but no one responded to him. But i see others saying they are able to use it, if you can give me an example of how to make it work that would be great. Thanks in advance.
_________________________________________________________________
Try amazing new 3D maps
http://maps.live.com/?wip=51