Frameless and transparent window qt5

前端 未结 1 517
無奈伤痛
無奈伤痛 2020-12-08 10:15

I\'m quite new to qt and c++ and I\'ve encountered a problem that I can\'t seem to figure out. I\'m wanting to open a frameless and transparent window when I click a button

相关标签:
1条回答
  • 2020-12-08 10:57

    Try this:

    setWindowFlags(Qt::Widget | Qt::FramelessWindowHint);
    setParent(0); // Create TopLevel-Widget
    setAttribute(Qt::WA_NoSystemBackground, true);
    setAttribute(Qt::WA_TranslucentBackground, true);  
    setAttribute(Qt::WA_PaintOnScreen); // not needed in Qt 5.2 and up
    
    0 讨论(0)
提交回复
热议问题