查看完整版本: [-- QSplashScreen无法背景透明的解决办法 --]

QTCN开发网 -> Qt代码秀 -> QSplashScreen无法背景透明的解决办法 [打印本页] 登录 -> 注册 -> 回复主题 -> 发表主题

cangyuegui 2016-06-02 10:45

QSplashScreen无法背景透明的解决办法

setWindowFlags(Qt::WindowStaysOnTopHint | Qt::SplashScreen | Qt::FramelessWindowHint);

setAttribute(Qt::WA_NoBackground, true);
setAttribute(Qt::WA_NoSystemBackground, true);
setAttribute(Qt::WA_TranslucentBackground, true);


解决SplashScreen无法加载Stylesheet
void MySplash::paintEvent(QPaintEvent *e)
{
    //强制StyleSheet生效
    QStyleOption opt;
    opt.init(this);
    QPainter p(this);
    style()->drawPrimitive(QStyle::PE_Widget, &opt, &p, this);

    return QSplashScreen::paintEvent(e);

};


米饭拌面 2016-11-04 14:44

stlcours 2016-11-04 22:46
能不能讲讲原来的QSplashScreen为什么无法透明呢?它也是继承自QWidget呀~

cangyuegui 2018-01-12 12:38
stlcours:能不能讲讲原来的QSplashScreen为什么无法透明呢?它也是继承自QWidget呀~ (2016-11-04 22:46) 

Qt自己的bug

stlcours 2018-01-15 17:22
cangyuegui:Qt自己的bug (2018-01-12 12:38) 

是哪个版本的bug?我用qt5.6.2没有这个问题

cangyuegui 2018-01-16 09:16
应该是5.3.0
时间过去比较久了

明ming 2018-01-17 16:20
QPixmap start(":/picture/startlogo/startlogo/start.png");
    QSplashScreen SplashScreen(start);
    SplashScreen.setMask(start.mask());
    SplashScreen.show();

希望能给你帮助


查看完整版本: [-- QSplashScreen无法背景透明的解决办法 --] [-- top --]



Powered by phpwind v8.7 Code ©2003-2011 phpwind
Gzip disabled