Important: Please read the Qt Code of Conduct -

QLabel doesn't get transparent background and editable text even so i did set the right flags

  • Hello
    i have QLable that i panting in QStyledItemDelegate item .
    in the constructor i define :
    @pLabel_title = new QLabel();
    pLabel_title->setStyleSheet("QLabel { background-color : transparent; }");

    and in the paint method i set the text and the Lable position

    @QString Title = pItem->title();
    QRect TextEditRect(option.rect.x()+THUMB_WIDTH+THUMB_WIDTH+PADDING, option.rect.y() ,
    pLabel_title->width(), pTextEdit_title->height());

     QPixmap pixmap(pLabel_title->size());


    every thing is shown but the QLable background stay gray color ( the QStyledItemDelegate is gradient color)
    and i can't select or do any thing that the setTextInteractionFlags let me do .
    i just see the text. what im doing wrong here ?

  • Have you see the article "QWidget Semi-transparent Background Color": ? It shows how to make a QWidget semi-transparent and might give you a hint.

  • Hi thanks to the replay , i implement custom QLabel with this paintevent
    but still it shows gray color . i suspect i messed something with the item background color
    that i set to gradient , i dont know ... its driving me crazy .

Log in to reply