PDA

View Full Version : ASSERT(visualRow!=-1 ) Fails !



fmariusd
4th February 2010, 12:50
this ASSERT(visualRow!=-1 ) in file qtableview.cpp at line 992 fails . What does this mean : visualRow equals -1?
i am using qt 4.6.0 on windows

Thanks !

fmariusd
9th February 2010, 12:47
............................. so ? :p

franz
10th February 2010, 21:44
It means that visualRow equals -1, which should never be the case. To say it more bluntly, it probably means you're doing something wrong in the code that uses the QTableView.

fmariusd
4th June 2010, 14:05
I was deleting rows with the mouse in a tableview and when i deleted the last row the above problem occured.(each row had an X button for delete)
Solution : select the last existing row in the tableview.

Kyef
15th May 2016, 00:00
This an old post but may be for colleagues who may face the the same challenge. I have found very few ideas on this....I faced the same scenario that led me to this Thread. My tableview was attached to a proxy model and a delegate. The table content was controlled by a mapper index where by each time the mapper changes...the content had to change. THUS I had to empty the tableview with view->setModel(NULL) (otherwise a static persistentEditor was being created especially the first index(i.e index(0,0)) once current Mapper Index was changed) The Crash only happens when the current tableview index is left blank ...but then for my case it was crashing only when other indexes having some data before the Mapper Index...changed

Well, I solved it by emptying the tableview before submitAll() or revertAll() QSqlRelationalTableModel functions! Also before you close the window make sure to setFocus() on another widget (other than the tableview) on the window. All these are workarounds but If someone has a better solution please explain. I hope this helps someone!