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. setStyleSheet with background image and custom alpha level
Forum Updated to NodeBB v4.3 + New Features

setStyleSheet with background image and custom alpha level

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k Views 2 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.
  • C Offline
    C Offline
    cherple
    wrote on last edited by
    #1

    I have a panel which i setStyleSheet("background-image...") and it displays my image nicely. But what i want to do now is to be able to set the alpha level for the image, so that i can see (there is another image below the panel) what is below the image. I know that i can set the alpha level using background-colour, but right now i am using background-image, if i set background color(0,0,0,100), it will turn my panel to alpha 100, but my image will also be gone as it will be set to color RGB(0,0,0).

    So is there any way i can continue using setStyleSheet background-image and set the alpha level for the image? Maybe load my image into QImage or something, set the alpha level, then set it as my stylesheet background?

    1 Reply Last reply
    0
    • McLionM Offline
      McLionM Offline
      McLion
      wrote on last edited by
      #2

      Try with this setting

      setAttribute(Qt::WA_TranslucentBackground);
      

      http://doc.qt.io/qt-4.8/qwidget.html#transparency-and-double-buffering

      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