QT4: Transparent Window with rounded corners

前端 未结 3 1787
你的背包
你的背包 2020-12-03 01:40

How can I create a partially transparent window with rounded borders (no standard borders)?

(I used Qt::FramelessWindowHint to disable standard border

3条回答
  •  执念已碎
    2020-12-03 02:03

    I had a similar problem where I wanted to paint on a toplevel widget and have only the painted part appear. setWindowOpacity changed the opacity of the painted part, which I didn't want.

    this->setAttribute(Qt::WA_TranslucentBackground, true);
    

    changed the opacity of the widget without the painted part. I just tried tossing on a button, and that also displays perfectly opaque. So you should be able to display other children however you like.

提交回复
热议问题