PDA

View Full Version : Im became fool with QTableWidgetItem



zorro68
28th February 2007, 10:50
My project works fine, and now (and i dont know why) have and error. Im trying to read from a tablewidget and write to a file, and I use this functions:



QString Sheet::getcellvalue(int row,int col)
{
QTableWidgetItem *newItem = tabla->item(row,col);
QString qv = newItem->text();
return qv;
}


where "tabla" is a QTableWidget. Now the compiler says:

Excepción no controlada en 0x6524c1ac en QTDAM.exe: 0xC0000005: Infracción de acceso al leer la ubicación 0x00000000.

I was using .toStdString to convert QStrings to strings, and now .toLatin1. And when i change this, this code give me this error ????????.

Why? and How to programm well.

Please help.
Thanks:confused:

wysota
28th February 2007, 10:53
Check if newItem != 0.

zorro68
28th February 2007, 11:58
Yes, this is the problem. First time I used this function, "tabla" was no created, but if I checked newItem and return 0 (if is 0) works.

Thank you very much. God pay you with a lot of children or a lot of money (you choose but remember in matrix film, blue pill or red pill)

Thanks

wysota
28th February 2007, 12:17
Or with a lot of children who will make a lot of money ;)