QSplashScreen无法背景透明的解决办法(强制StyleSheet生效)

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);

};

http://www.qtcn.org/bbs/read-htm-tid-61177.html

posted @ 2016-06-02 18:38  findumars  Views(1191)  Comments(0Edit  收藏  举报