QT 設置陰影邊框

    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控件,與父佈局增加一些邊距,然後再設置上邊這一段代碼。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章