ui->setupUi(this);
ui->frame->setStyleSheet("QFrame{background-color: rgb(255, 255, 255);border-radius:1px}");
QGraphicsDropShadowEffect *effect = new QGraphicsDropShadowEffect(this);
effect->setOffset(0, 0);
effect->setColor(Qt::black);
effect->setBlurRadius(22);
ui->frame->setGraphicsEffect(effect);
this->setAttribute(Qt::WA_TranslucentBackground);//父佈局設置爲透明
.ui文件中增加frame控件,與父佈局增加一些邊距,然後再設置上邊這一段代碼。