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:

Qt Code:
  1. // for testing
  2. QList<QWidget*> wList;
  3. for(int i = 0; i < 500; i++) {
  4. wList << (new QWidget());
  5. }
To copy to clipboard, switch view to plain text mode 

And the cost is:
1.png

Qt Code:
  1. for(int i = 0; i < 500; i++) {
  2. wList << (new QWidget());
  3.  
  4. wList[i]->setAutoFillBackground(true);
  5. QPalette p(wList[i]->palette());
  6. p.setColor(QPalette::Background, Qt::red);
  7. wList[i]->setPalette(p);
  8. }
To copy to clipboard, switch view to plain text mode 

The cost becomes:
2.png

So is there any way to reduce the cost?