Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QLabel doesn't get transparent background and editable text even so i did set the right flags
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 5.5k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    umen242
    wrote on last edited by
    #1

    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 ?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      leon.anavi
      wrote on last edited by
      #2

      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.

      http://anavi.org/

      1 Reply Last reply
      0
      • U Offline
        U Offline
        umen242
        wrote on last edited by
        #3

        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 .

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved