PDA

View Full Version : [Question] How to get QWidget background transperent



hamburger
31st May 2013, 04:14
Hey got a big problem.

Googled now for 4 hours and tryed alot of idears...


My problem is that i want to draw over another application.

last thing whats missing is that only the background of the QWidget is transparent without the childs.


this->setWindowOpacity(0.25);

is "working" but it also makes all other things that i draw onto the frame transperent.


anyone got a way to resolv that problem?

rawfool
31st May 2013, 06:02
QWidget::setStyleSheet("background-color: transparent;");

karankumar1609
31st May 2013, 08:34
You can set the stylesheet (http://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CC8QFjAA&url=http%3A%2F%2Fqt-project.org%2Fdoc%2Fqt-4.8%2Fstylesheet-examples.html&ei=5UOoUcGfJMHVrQeSyoGoAg&usg=AFQjCNGoOyg0OrWa44ZmL4PQ2YMJp69z-A&sig2=nxKQRZEBt_pRLxgcoKO_DA&bvm=bv.47244034,d.bmk)to your widget.



// Set window color transparent and border to none
myWidget->setStyleSheet("background-color: transparent; border: none;");


CHEERS

hamburger
31st May 2013, 11:48
hey thanks for your fast replay.

if i use: this->setStyleSheet("background-color: transparent; border: none;");

the Window is just completly black.


this is my code in constructor:



ui->setupUi(this);
this->setStyleSheet("background-color: transparent; border: none;");