Frage

I'm trying to display QWebView where the contents will have round corners, so I need transparent background in order to hide the original white corners. I'm using the "trick" I found here

This did not work for me so I added

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

and now it works how it is supposed to on Linux(Ubuntu) and Windows, but not Mac OS X. Mac OS X just keeps displaying black corners. I tried setting stylesheet like this

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

or

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

or

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

But nothing worked. Is there any way I can make that work? I'm using Qt 5.0.2.

War es hilfreich?

Lösung 2

I finally solved the problem by upgrading Qt from 5.0.2 to 5.1.0. It's not optimal solution but it seems that there is a lot of regressions from 4.x to 5.0.x.

Andere Tipps

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

I made a project a while back for displaying notification widgets in the system tray across all platforms compatible with Qt.

The trick is to make nested widgets with the parent widget having no border and no background and the child widget will be your display widget which you can customize with QSS.

Here's some sample images of how it looks:
Windows 7
Windows 7
Mac OS X Lion
Mac OS X Lion
Ubuntu
Ubuntu
I hope this helps. Let me know if you have any questions.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top