qt 不继承父窗口背景色

this->setAttribute(Qt::WA_TranslucentBackground);//透明
this->setAttribute(Qt::WA_NoSystemBackground, false);//不继承父类窗口背景色

我发现了一个问题:上面两句代码顺序不同时,效果不一样。上述顺序时,能达到想要的效果。
如果是下面顺序:
this->setAttribute(Qt::WA_NoSystemBackground, false);//不继承父类窗口背景色
this->setAttribute(Qt::WA_TranslucentBackground);//透明

则达不到想要的效果。

posted @ 2022-12-06 13:12  阳光下的小土豆  阅读(731)  评论(0编辑  收藏  举报