i use the following to fill the data into the spreadsheet. the fill_dataNC function is called every time user clicks ok button after giving input.
but it takes only the first 2 to 4 inputs and den gives this error --
*** glibc detected *** ./shm1: malloc(): memory corruption (fast): 0x00000000011e3f11 ***
please help me solve this
void Spreadsheet::clear()
{
setRowCount(0);
setColumnCount(0);
setRowCount(RowCount);
setColumnCount(ColumnCount);
tableWidget = new QTableWidget(0, ColumnCount);
for (int i = 0; i < RowCount; ++i)
{
int row = tableWidget->rowCount();
tableWidget->insertRow(row);
}
setCurrentCell(0,0);
}
void Spreadsheet::fill_dataNC()
{
int rowNo = ip3; // user input
int colNo = ip1; // user input
int sampRa = ip2; // user input
if(flag == 0)
{
while(rowNo < RowCount)
{
setItem(rowNo,colNo,new QTableWidgetItem(QString::number(a16bit, 16) + QChar('x')));
item(rowNo,colNo)->setBackgroundColor(Qt::lightGray);
wordCount++;
emptyCount--;
rowNo = rowNo + sampRa;
}
}
else
{
while(rowNo < RowCount)
{
while(colNo < ColumnCount)
{
setItem(rowNo,colNo,new QTableWidgetItem(QString::number(a16bit, 16) + QChar('x')));
item(rowNo,colNo)->setBackgroundColor(Qt::cyan);
wordCount++;
emptyCount--;
colNo = colNo + sampRa;
}
rowNo++;
}
}
}


Reply With Quote


Bookmarks