Hi,

I have a widget whose constructor is something like this :

Qt Code:
  1. pal.setBrush(QPalette::Window,QBrush(QPixmap(":/images/background.png")));
  2. setPalette(pal);
  3.  
  4. nameLabel = new QLabel(tr("Name"),this);
  5. nameLabel->setFont(QFont("Arial",9));
  6.  
  7. QIcon icon(":/images/plusbutton.png");
  8. addButton = new QPushButton(tr(""),this);
  9. addButton->setIcon(icon);
  10. addButton->setFlat(true);
  11. addButton->setFixedSize(20,20);
  12. connect(addButton,SIGNAL(pressed()),this,SLOT(addContact()));
  13.  
  14. QHBoxLayout *hLay = new QHBoxLayout;
  15. hLay->addSpacing(5);
  16. hLay->addWidget(nameLabel);
  17. hLay->addStretch(1);
  18. hLay->addWidget(addButton);
  19.  
  20. nameListWidget = new NameListWidget(c,this);
  21. connect(nameListWidget,SIGNAL(currentItemChanged(QListWidgetItem *,QListWidgetItem *)),
  22. this,SLOT(selectionChanged(QListWidgetItem *,QListWidgetItem *)));
  23. connect(nameListWidget,SIGNAL(clearContact()),this,SLOT(clearContact()));
  24.  
  25. //connect(nameListWidget,SIGNAL(currentRowChanged(int )),this,SLOT(selectionChanged(int )));
  26.  
  27. QVBoxLayout *mainLayout = new QVBoxLayout;
  28. mainLayout->setMargin(0);
  29. mainLayout->addSpacing(5);
  30. mainLayout->addLayout(hLay);
  31. mainLayout->addWidget(nameListWidget);
  32. setLayout(mainLayout);
To copy to clipboard, switch view to plain text mode 

The background is not changing though I have set the palette.

Can someone please help ?
Thanks a lot.