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->setTextFormat(Qt::PlainText);
    pLabel_title->setTextInteractionFlags(Qt::LinksAccessibleByKeyboard|Qt::LinksAccessibleByMouse|Qt::TextBrowserInteraction|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse);
    pLabel_title->setStyleSheet("QLabel { background-color : transparent; }");
    pLabel_title->setGeometry(rect);@

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

    @QString Title = pItem->title();
    pLabel_title->setText(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());
    

    pLabel_title->render(&pixmap);@

    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":http://developer.qt.nokia.com/wiki/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
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.