I have a class which is custom widget for QTableWidgetItem. Using Qt 4.8 everything was OK, but in Qt 5.2.1 there is a problem.

My widget class:
Qt Code:
  1. class QTableCalendarWidget: public QWidget
  2. {
  3. Q_OBJECT
  4. public:
  5. QTableCalendarWidget(QString ToolTip,bool Ev,bool BDay)
  6. {
  7. Date=QDate::fromString(ToolTip,"d/MM/yyyy");
  8. Event=new QLabel(this);
  9. Birth=new QLabel(this);
  10. Label=new QLabel(QString::number(Date.day()),this);
  11. Add=new QPushButton(this);
  12. QPixmap w=QPixmap(12,12);
  13. w.fill(Qt::transparent);
  14. if(Ev)
  15. {
  16. Event->setPixmap(QIcon(":/cal/Ev").pixmap(15));
  17. }
  18. else
  19. {
  20. Event->setPixmap(w);
  21. }
  22. if(BDay)
  23. {
  24. Birth->setPixmap(QIcon(":/cal/BDay").pixmap(15));
  25. }
  26. else
  27. {
  28. Birth->setPixmap(w);
  29. }
  30. Label->setAlignment(Qt::AlignHCenter);
  31. Add->setStyleSheet("QPushButton {border: 0px solid white;}");
  32. Add->setIcon(QIcon(w));
  33. Add->setDisabled(true);
  34. connect(Add,SIGNAL(clicked()),this,SLOT(addIN()));
  35. QHBoxLayout *Layout=new QHBoxLayout();
  36. Layout->setSpacing(1);
  37. Layout->addWidget(Event);
  38. Layout->addWidget(Birth);
  39. Layout->addWidget(Label,Qt::AlignHCenter);
  40. Layout->addWidget(Add);
  41. this->setLayout(Layout);
  42. }
  43. void AddB()
  44. {
  45. Add->setEnabled(true);
  46. Add->setIcon(QIcon(QIcon(":/main/Add").pixmap(12,12)));
  47. }
  48. private:
  49. QDate Date;
  50. QLabel *Event;
  51. QLabel *Birth;
  52. QLabel *Label;
  53. private slots:
  54. void addIN()
  55. {
  56. emit addOUT(Date);
  57. }
  58. signals:
  59. void addOUT(QDate);
  60. };
To copy to clipboard, switch view to plain text mode 

I am setting widget this way:
Qt Code:
  1. QTableCalendarWidget *Day=new QTableCalendarWidget(Items[i]->toolTip(),Ev,Bd);
  2. Calendar->setCellWidget(Items[i]->row(),Items[i]->column(),Day);
To copy to clipboard, switch view to plain text mode 
Where Items[i] is QTableWidgetItem already added to QTableWidget, with date as a ToolTip.

The appearance:zrzut ekranu2.png

As all of you can see the custom widget is flat. Standard QTableWidgetItem is visible normally.