October 29, 2010

yaoyulian yaoyulian
Lab Rat
4 posts

[Solved] How Can I make the QToolBox panel transparent?


Is there a Sub-Controls like QToolBox::tab make the Qwidget in QToolBox transparent?
I tryed:
1) QWidget#page{background:rgb(12,34,56);}
this work, but
this one not work.
I guess there maybe a Sub-Controls like QToolBox::tab.
is it?
How Can I reach my purpose?

4 replies

November 2, 2010

Antonio Di Monaco Antonio Di Monaco
Lab Rat
109 posts


did you try “background: rgba(12,34,56,0);” ??


November 3, 2010

yaoyulian yaoyulian
Lab Rat
4 posts

Thanks for Antonio Di Monaco’s reply.
“background: rgba(12,34,56,0)” can’t work too.
From the source code, I found out that QToolBox is made up by :

  1.         QToolBoxButton *button;
  2.         QScrollArea *sv;
  3.         QWidget *widget;

I tryed :
  1. background-color:transparent;
  2. }
  3. QWidget#page_2{background:transparent;}

in toolbox’s “change stylesheet” menu.
this can change the toolbox transparent.

April 5, 2013

ChanchoCiego ChanchoCiego
Lab Rat
49 posts


  1. {
  2.     background-color: background: rgba(12,34,56,0);
  3. }

but also makes transparent the sub-controls of the QWidget from QToolBox

sorry for my bad (bing-translator) english


April 9, 2013

raven-worx raven-worx
Robot Herder
1777 posts

try setting the following on the Toolbox window:

  1. setAttribute(Qt::WA_TranslucentBackground);
  2. setWindowFlags(Qt::FramelessWindowHint);

(beside your stylesheet declaration)

or another possibility: QGraphicsOpacityEffect [qt-project.org]
But this also applies for the child widgets.

btw: This is no valid stylesheet declaration AFAIK.

ChanchoCiego wrote:
  1. {
  2.     background-color: background: rgba(12,34,56,0);
  3. }

Also a nice trick i used to do was setting the background color not to fully transparent but to something like this: rgba(0,0,0,1)
This almost has the same effect like transparency but it’s not. Thus it’s also treaded differently by the windowing system and may help you.

  ‹‹ Universal solution for resource prefix.      Events and QMacNativeWidget ››

You must log in to post a reply. Not a member yet? Register here!