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. When I try to set the background to semi transparent or transparent , the background gets black

When I try to set the background to semi transparent or transparent , the background gets black

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 718 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.
  • P Offline
    P Offline
    Project try
    wrote on last edited by
    #1

    As I mentioned the background goes black when I try to set it to transparent ot semi transparent.

    I tried this:

    @
    QPalette P;
    P.setBrush(QPalette::Background , Qt::transparent);
    setPalette(P);
    @

    and this:

    @
    this->setStyleSheet("QMainWindow {background:transparent}");
    @

    also some other things like using rgba.

    1 Reply Last reply
    0
    • P Offline
      P Offline
      Project try
      wrote on last edited by
      #2

      the only valid way to do this that worked with me is:

      @
      setWindowOpacity(qreal)
      @

      but the problem with this is that I'm using widget that their parents is my mainwindow which I want it to be transparent , so if I set my main window to semi transparent using setWindowOpacity() it'll effect all of my widgets.

      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