I use Qt5 to make a application.
Mainwindow::Mainwindow(QWidget *parent) :
QWidget (parent),
ui(new Ui::Mainwindow)
{
setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground,true);
QGraphicsDropShadowEffect* eff = new QGraphicsDropShadowEffect(this);
eff->setOffset(0);
eff->setBlurRadius(4);
eff->setColor(QColor(0,0,0,255*0.9);
this->setGraphicsEffect(eff);
ui->setupUi(this);
show();
}
It is not display in windows 7 except I let it minimize and show it again, it will display normal, but it works fine in windows XP.
And when I use Qt4.8.5 , it worked fine both windows 7 and XP.
How could I correct it?
I do some work according to the google search to try, but has no effect.
setParent(0); // Create TopLevel-Widget
setAttribute(Qt::WA_NoSystemBackground, true);
setAttribute(Qt::WA_TranslucentBackground, true);
setAttribute(Qt::WA_PaintOnScreen);
↧