i have strange problem i have item delegate inherit from QStyledItemDelegate the background color is gradient color that looks like this :

Qt Code:
  1. void ItemDelegate::paintActiveOverlay( QPainter *painter, qreal x, qreal y, qreal w, qreal h ) const {
  2.  
  3. QPalette palette;
  4. QColor highlightColor = palette.color(QPalette::Highlight);
  5. QColor backgroundColor = palette.color(QPalette::Base);
  6. const float animation = 0.25;
  7. const int gradientRange = 16;
  8.  
  9. QColor color2 = QColor::fromHsv(
  10. highlightColor.hue(),
  11. (int) (backgroundColor.saturation() * (1.0f - animation) + highlightColor.saturation() * animation),
  12. (int) (backgroundColor.value() * (1.0f - animation) + highlightColor.value() * animation)
  13. );
  14. QColor color1 = QColor::fromHsv(
  15. color2.hue(),
  16. qMax(color2.saturation() - gradientRange, 0),
  17. qMin(color2.value() + gradientRange, 255)
  18. );
  19. QRect rect((int) x, (int) y, (int) w, (int) h);
  20. painter->save();
  21. painter->setPen(Qt::NoPen);
  22. QLinearGradient linearGradient(0, 0, 0, rect.height());
  23. linearGradient.setColorAt(0.0, color1);
  24. linearGradient.setColorAt(1.0, color2);
  25. painter->setBrush(linearGradient);
  26. painter->drawRect(rect);
  27. painter->restore();
To copy to clipboard, switch view to plain text mode 

its called from the paint method also in the ItemDelegate constructor i have set QLable like this :

Qt Code:
  1. QRect rect(40, 30, 401, 31);
  2. Qt::TextInteractionFlags flags = Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse;
  3. Qt::TextFormat txtFormat = Qt::PlainText;
  4.  
  5.  
  6. pTextEdit_title = new QLabel();
  7. pTextEdit_title->setTextFormat(txtFormat);
  8. pTextEdit_title->setTextInteractionFlags(flags);
  9. pTextEdit_title->setGeometry(rect);
To copy to clipboard, switch view to plain text mode 

and in the paint method of the ItemDelegate i set the Qlable to render like this :

Qt Code:
  1. pTextEdit_title->setText(Title);
  2. QRect TextEditRect(option.rect.x()+THUMB_WIDTH+THUMB_WIDTH+PADDING, option.rect.y() ,
  3. pTextEdit_title->width(), pTextEdit_title->height());
  4. QPixmap pixmap(pTextEdit_title->size());
  5. pTextEdit_title->render(&pixmap);
  6. painter->drawPixmap(TextEditRect,pixmap);
To copy to clipboard, switch view to plain text mode 

it render the QLable file , but the problem is that it has gray background and dosnt act as transparent background , my question is how to set the QLable background to be transparent?