lwz
29th September 2014, 09:46
Hi, in my program I use QicsTable as a container, and put it into a qscrollarea, but as the size of the table's cell getting bigger, memory is consuming more. I think the qscrollarea seems the table's cell as an unit, and paint the whole cell all the time.
Is there any way to optimize it ?
Below is a simple example, which costs memory up to 280m. And sometimes i need the size to be (300, 167010), in this case memory cost(up to 1G) is unacceptable.
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow window;
QicsDataModel *dmPlots = new QicsDataModelDefault(1, 4);
QicsTable *tables = new QicsTable(dmPlots);
for (int i = 0; i < 4; i++) {
tables->cellRef(0, i).setWidthInPixels(300);
tables->cellRef(0, i).setHeightInPixels(32000);
}
QScrollArea *area = new QScrollArea();
area->setWidget(tables);
area->setFixedWidth(300);
window.setCentralWidget(area);
window.resize( 400, 600 );
window.show();
return a.exec();
}
Is there any way to optimize it ?
Below is a simple example, which costs memory up to 280m. And sometimes i need the size to be (300, 167010), in this case memory cost(up to 1G) is unacceptable.
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QMainWindow window;
QicsDataModel *dmPlots = new QicsDataModelDefault(1, 4);
QicsTable *tables = new QicsTable(dmPlots);
for (int i = 0; i < 4; i++) {
tables->cellRef(0, i).setWidthInPixels(300);
tables->cellRef(0, i).setHeightInPixels(32000);
}
QScrollArea *area = new QScrollArea();
area->setWidget(tables);
area->setFixedWidth(300);
window.setCentralWidget(area);
window.resize( 400, 600 );
window.show();
return a.exec();
}