[Development] How to set QQuickView TranslucentBackground

hailong geng longlongh4 at yahoo.com
Thu Mar 8 14:24:10 CET 2012


Hi
Thank you for your reply. What do you mean by "setting a non-zero 
alpha in the QSurfaceFormat of the QWindow"? I tried to use the following code but still get black background.
    QQuickViewcanvas;
QSurfaceFormatsurfaceFormat;
surfaceFormat.setAlphaBufferSize(1000);
canvas.setFormat(surfaceFormat);
canvas.setClearBeforeRendering(true);
canvas.setClearColor(QColor(Qt::transparent));
canvas.setWindowFlags(Qt::FramelessWindowHint);

       Would you please tell me something about how does Qt Quick2 render the scene? I think it doesn't render opengl into video memory 
directly because if so, when I drag one other window above the qml scene, it should flash :) So does it use QGLPixelBuffer class for that? 
I am new to opengl and scene graph, I am not clear with the work flow. But I really want to make the QML View Translucent, this will be very cool ^_^





On 03/08/2012 02:37 AM, ext hailong geng wrote:
> Hi
> What I have to say is that Qt5 is really cool, I love it ^_^
> But I get a problem, I want to show some lovely tools in desktop, in
> order to move them freely, I want to set the window Translucent and show
> the app in FullScreen mode(or in available screen geometry).In Qt4 I can
> set Qt::WA_TranslucentBackground and it works well. Now I want use Qt5
> to do that, but I can't find the way, I tried the following code and got
> only a grey background. I used the mine example to test and the code I
> have changed is marked in yellow.

This sounds like it needs to be solved at the QQuickCanvas-level 
somehow. Translucency in Qt 5 should work simply by setting a non-zero 
alpha in the QSurfaceFormat of the QWindow, and making sure to first 
clear the background with transparent.

--
Samuel  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20120308/5f50d2ab/attachment.html>


More information about the Development mailing list