You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
auto doc = new QXlsx::Document(filename, this);
auto workSheet = doc->currentWorksheet();
// ... some code for getting dataModelauto modelSize = dataModel->itemCount();
for (int i = 0; i < modelSize; ++i)
{
for (int j = 2; j < dataModel->columnCount(); ++j)
{
currentCell.setColumn(1 + j);
QVariant value = dataModel->data(dataModel->index(i, j), Qt::DisplayRole);
switch (value.type())
{
case QVariant::Type::Double:
workSheet->writeNumeric(currentCell, value.toFloat());
break;
case QVariant::Type::Int:
workSheet->writeNumeric(currentCell, value.toInt());
break;
default:
workSheet->writeString(currentCell, value.toString());
break;
}
}
QApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
}
doc->save();
doc->deleteLater();
The dataModel is instance of class, that's inherits the QAbstractTableModel class. It can contain a large amount of data. In my case I trying to write in .xlsx file 30k rows with 6 columns for each row. During the execution of the doc destructor, the main application freezes. Using CDB I saw that the application executes destructors of a large number of QSharedPointer objects. But the application freezes for a very long time, it feels like there is some kind of memory corruption somewhere inside QXlsx. If someone has encountered a similar problem please help me with its solution, I will be very grateful! 😅
The text was updated successfully, but these errors were encountered:
I have a similar code:
The
dataModel
is instance of class, that's inherits theQAbstractTableModel
class. It can contain a large amount of data. In my case I trying to write in.xlsx
file 30k rows with 6 columns for each row. During the execution of thedoc
destructor, the main application freezes. Using CDB I saw that the application executes destructors of a large number ofQSharedPointer
objects. But the application freezes for a very long time, it feels like there is some kind of memory corruption somewhere inside QXlsx. If someone has encountered a similar problem please help me with its solution, I will be very grateful! 😅The text was updated successfully, but these errors were encountered: