PDA

View Full Version : Problem with QTableView



BoneCollector
18th February 2008, 09:01
Hi,

Here is a piece of (pseudo) code from my application


model = new QSqlTableModel();
model->setTable(tables->currentText());
model->setFilter("id=2");
model->select();

view = new QTableView();
view->setModel(model);

/*model->setTable(tables->currentText());
model->setFilter("id=3");
model->select();*/

Problem is : when last section of example is commented in, view will show wrong number of lines. If first select returns one row, and second also one, then view shows two lines : one is containing last result and second is just empty row.
Problem goes away if setTable is not used second time, but there is nowhere said, that setTable is forbidden to use twice.

PS: second select is after "view->setModel(model);" because in real application it is called in slot, not in same method as first select and view/model creation.

A Qt bug?

wysota
18th February 2008, 13:44
Which version of Qt are you using?

BoneCollector
18th February 2008, 13:56
forgot about that,

Qt 4.3.3
on Gentoo Linux, database used MySql

wysota
18th February 2008, 14:23
Check if tasktracker contains any entries relevant to the problem.

BoneCollector
18th February 2008, 14:37
Already tried, but going one more time to that, maybe missed one.

BoneCollector
12th March 2008, 13:30
Finally, got this problem accepted as a bug

http://trolltech.com/developer/task-tracker/index_html?id=201361&method=entry