Transparent QWebView for Mac OS X

I am trying to display a QWebView where the content will have round corners, so I need a transparent background to hide the original white corners. I use the "trick" I found here

This did not work for me, so I added

this->view.setAttribute(Qt::WA_TranslucentBackground); 

and now it works as expected on Linux (Ubuntu) and Windows, but not Mac OS X. Mac OS X just keeps showing black angles. I tried setting a style sheet like this

 this->view.setStyleSheet("background: transparent;"); 

or

 this->view.setStyleSheet("background-color: none"); 

or

 this->view.setStyleSheet("QWidget { background: transparent; }"); 

But nothing happened. Is there any way to make this work? I am using Qt 5.0.2.

+4
source share
2 answers

I finally solved the problem by updating Qt from 5.0.2 to 5.1.0 . This is not an optimal solution, but it seems that there are many regressions from 4.x to 5.0.x.

0
source

Check out this code: https://github.com/pcmantinker/Tray-Notification-System/blob/master/traynotificationwidget.cpp

I did a project again to display notification widgets in the system tray on all Qt compatible platforms.

The trick is to make nested widgets with parent widgets without borders and without background, and the child widget will be your widgets that you can customize using QSS.

Here are some examples of images of how this looks:
Windows 7
Windows 7
Mac OS X Lion
Mac OS X Lion
Ubuntu
Ubuntu
Hope this helps. Let me know if you have any questions.

+2
source

Source: https://habr.com/ru/post/1487862/


All Articles