繁体   English   中英

QLabel变成黑色而不是透明

[英]QLabel becomes black instead of transparent

我有QLabel,我想使其透明(实际上是半透明的)。 对我唯一setWindowOpacity(0.5)setWindowOpacity(0.5) 但这也使文本透明。

我试过了:

  1. setStyleSheet("QWidget{background-color: transparent;}")
  2. setStyleSheet("background-color: rgba(0,0,0,0)")
  3. setAttribute(Qt::WA_TranslucentBackground, true);
  4. setAttribute( Qt::WA_OpaquePaintEvent, true );

但是窗口变黑了,我不知道为什么。 我的操作系统Windows 10 x64。

我添加了this->setWindowFlags(Qt::FramelessWindowHint);
现在this->setAttribute(Qt::WA_TranslucentBackground, true); 作品。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM