PDA

View Full Version : tableview and layouts



zorro68
10th February 2007, 18:06
I have used a tableview but when i try to put this table into a qwidget and use a Layout, i get an error....

QHBoxLayout *Layout3=new QHBoxLayout();
Layout3->addWidget(tableView);

error C2664: 'QBoxLayout::addWidget' : no se puede convertir el parámetro 1 de 'QTableView' a 'QWidget *'

I know that a tableview is not a QWidget, but how can i transform a tableview to a QWidget, or how can i use layouts with qtableview?????:confused:

jpn
10th February 2007, 18:21
Actually, QTableView is a QWidget. Looks like the table view is allocated on the stack. Allocate it on the heap (with operator "new") and pass the pointer to the table view to QBoxLayout::addWidget().