cic
11th September 2013, 09:22
Morning all,
i used QPalette to set the widget's background color. But the cost after that increased a lot.
e.g from 46mb --> 55mb.
One example to see the cost is as followed:
// for testing
QList<QWidget*> wList;
for(int i = 0; i < 500; i++) {
wList << (new QWidget());
}
And the cost is:
9568
for(int i = 0; i < 500; i++) {
wList << (new QWidget());
wList[i]->setAutoFillBackground(true);
QPalette p(wList[i]->palette());
p.setColor(QPalette::Background, Qt::red);
wList[i]->setPalette(p);
}
The cost becomes:
9569
So is there any way to reduce the cost?
i used QPalette to set the widget's background color. But the cost after that increased a lot.
e.g from 46mb --> 55mb.
One example to see the cost is as followed:
// for testing
QList<QWidget*> wList;
for(int i = 0; i < 500; i++) {
wList << (new QWidget());
}
And the cost is:
9568
for(int i = 0; i < 500; i++) {
wList << (new QWidget());
wList[i]->setAutoFillBackground(true);
QPalette p(wList[i]->palette());
p.setColor(QPalette::Background, Qt::red);
wList[i]->setPalette(p);
}
The cost becomes:
9569
So is there any way to reduce the cost?