How to make QDialog transparent in windows 7/10 ?



  • I have below code
    setStyleSheet("background:transparent;");
    setAttribute(Qt::WA_TranslucentBackground);
    ui->setupUi(this);
    which gives me transparent window in linux. But the same gives black background in windows. How to achieve the transparency in windows also ?


  • Qt Champions 2016

    Hi
    It would only work for me on win 7 if i set
    setWindowFlag(Qt::FramelessWindowHint,true);
    but then it looses its border/caption.



  • I don't know how we will solve this. I tried many solutions but all fails and partially fixed. Finally i reported an issue QTBUG-65969


  • Qt Champions 2016

    Hi
    ok super.
    I moved to linux so didn't try a lot but i also tried
    palette but had no luck with Dialogs.



  • @QtNovie

    Hi.
    Now you can only use Win32 api with Qt for that.



  • I gave up.
    https://bugreports.qt.io/browse/QTBUG-55955

    https://bugreports.qt.io/browse/QTBUG-28214

    I got this from support.

    I wonder how I have never noticed that before. It seems to not clear the
    buffer after moving. Strange flickering that occurs while moving is because
    there is double (or triple) buffering where each buffer seems to have separate
    copy of the view.
    
    Note that transparency does not always work. Windows does not support
    transparent OpenGL windows and Qt achieves this through DWM effects. DWM
    effects can be disabled on some machines, which would lead to just a solid
    black background. I am thinking this could even be a side effect of DWM and
    maybe has nothing to do with Qt actually.
    
    How ever, is there a reason why you want frames and a transparent background?
    This does not happen if you do this to the Window (/ApplicationWindow and for
    widget, there is similar flag):
    
    flags: Qt.FramelessWindowHint
    

    It got me thinking - no. I didn't need it that much.
    It's a windows thing - I'm used to it disappointing me now.

    I plan on supporting windows but pushing linux or linux/boot2qt solution.


Log in to reply
 

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