diff options
author | Alexis Menard <alexis.menard@openbossa.org> | 2012-06-18 18:18:34 -0300 |
---|---|---|
committer | Alexis Menard <alexis.menard@openbossa.org> | 2012-06-18 18:18:34 -0300 |
commit | 922ec70059a94fd5b7119a45a85641cbf8275b8a (patch) | |
tree | 3b08fb576d2581e43b70b72e365c69e42069f744 | |
parent | 9437f0d18a5045ee18f242e6885af0b32974f989 (diff) | |
download | snowshoe-922ec70059a94fd5b7119a45a85641cbf8275b8a.tar.gz |
Make Snowshoe popup translucents.
You need to set a specific surface format to get translucent background
on a QWindow. Unfortunately due to a bug even the main window should also
be setup as transparent for the popup to work correctly.
Reviewed-by: Rafael Brandao
-rw-r--r-- | src/core/PopupWindow.cpp | 5 | ||||
-rw-r--r-- | src/desktop/BrowserWindow.cpp | 5 |
2 files changed, 10 insertions, 0 deletions
diff --git a/src/core/PopupWindow.cpp b/src/core/PopupWindow.cpp index 221355f..e440fe4 100644 --- a/src/core/PopupWindow.cpp +++ b/src/core/PopupWindow.cpp @@ -22,6 +22,11 @@ PopupWindow::PopupWindow(QWindow* parent) : QQuickCanvas(parent) { setWindowFlags(Qt::Popup); + QSurfaceFormat surfaceFormat; + surfaceFormat.setAlphaBufferSize(8); + setFormat(surfaceFormat); + setClearBeforeRendering(true); + setClearColor(QColor(Qt::transparent)); } void PopupWindow::showEvent(QShowEvent* ev) diff --git a/src/desktop/BrowserWindow.cpp b/src/desktop/BrowserWindow.cpp index 00f915e..710adfa 100644 --- a/src/desktop/BrowserWindow.cpp +++ b/src/desktop/BrowserWindow.cpp @@ -38,6 +38,11 @@ BrowserWindow::BrowserWindow(const QStringList& arguments) , m_browserView(0) { setWindowFlags(Qt::Window | Qt::WindowSystemMenuHint | Qt::WindowTitleHint | Qt::WindowMinMaxButtonsHint | Qt::WindowCloseButtonHint); + QSurfaceFormat surfaceFormat; + surfaceFormat.setAlphaBufferSize(8); + setFormat(surfaceFormat); + setClearBeforeRendering(true); + setClearColor(QColor(Qt::transparent)); qmlRegisterType<Shortcut>("Snowshoe", 1, 0, "Shortcut"); restoreWindowGeometry(); setupDeclarativeEnvironment(); |