QML/3D: how to get a frameless window and transparent background



  • Hi,
    I am trying to developing a stereo 3D application. I have successfully showing stereo 3D via Qt/3D on my Nvidia Quadro. I am on Window 7. However, I got issues when I tried to make the window frameless or make the window background transparent.

    1. I can successfully get a frameless window if I use the "hellogl" example in the regular Qt codes and use the "FramelessWindowHint". However, if I use the "teapot" example in the Qt/3D codes and use "FramelessWindowHint", the whole application does not show at all.
    2. I am also trying to make the window background transparent.

    Can someone help me on these 2 tasks?



  • Hi,
    I am trying to developing a stereo 3D application. I have successfully showing stereo 3D via QML/3D on my Nvidia Quadro. I am on Window 7. Currently, I am trying to make my window framelss and with a transparent background. Can some one give me some hint about how to do this on QML/3D?



  • [quote author="Charlie Hsin" date="1294705858"]

    1. I can successfully get a frameless window if I use the "hellogl" example in the regular Qt codes and use the "FramelessWindowHint". However, if I use the "teapot" example in the Qt/3D codes and use "FramelessWindowHint", the whole application does not show at all. [/quote]What's the difference between those two?

    [quote author="Charlie Hsin" date="1294705858"]2. I am also trying to make the window background transparent.[/quote]What have you tried so far?



    1. For the FramelessWindowHint task, the "hellogl" is just a example codes from Qt 4.7 release which does not use the Qt/3D. It uses QGLWidget. The "Teapot" example is from Qt/3D latest release, which uses QGLView. I added SetWindowFlags(...FramelessWindowHint) in the constructor. For hellogl example, it works. For Teapot example, the application exits immediately after I run it. If I take out the SetWindowFlags, it works.

    2. For the transparent background, I used Qt/3D teapot example and tried

    1. setStyleSheet("background:transparent;") and setAttribute(Qt::WA_TranslucentBackground): They do not result in any transparent effect at all. The background is still black.
    2. setWindowOpacity(0.5): This makes the whole window transparent, which is not what I want. Also, this makes the stereo effect not working. (The teapot is not stereo anymore.)

    BTW, I changed the format to use stereobuffers in main.cpp to enable hardware stereo effect for Teapot example.



  • I figured out the frameless window issue. If I do the following in TeapotView constructor, it works.

    Qt::WindowFlags flags = this->windowFlags();
    flags |= Qt::SplashScreen;
    this->setWindowFlags(flags);

    I didn't get the current flags before, and I guess that violates some QGLView operations. Also, "FramelessWindowHint" does not work in QGLView. I have to use "SplashScreen".

    I still haven't figured out the transparent window background part. Can anyone help me on that?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.