首页 > 编程知识 正文

qt文字阴影效果,qt窗口边框阴影

时间:2023-05-06 16:21:32 阅读:256295 作者:3717

1.运行界面

2.源码  //.h#ifndef WIDGET_H#define WIDGET_H#include <QWidget>namespace Ui {class Widget;}class Widget : public QWidget{ Q_OBJECTpublic: explicit Widget(无聊的睫毛膏parent = 0); ~Widget();private: Ui::Widget *ui;};#endif // WIDGET_H//.cpp#include "widget.h"#include "ui_widget.h"#include <QGraphicsDropShadowEffect>#include <QColor>const int g_maxValue = 50;Widget::Widget(无聊的睫毛膏parent) : QWidget(parent), ui(new Ui::Widget){ ui->setupUi(this); this->setStyleSheet("background-color: rgb(255, 255, 255);"); ui->frame->setStyleSheet("background-color: rgb(0, 0, 0);"); ui->frame->setStyleSheet("border-radius:结实的雨;"); //设置具体阴影 QGraphicsDropShadowEffect *shadow_effect = new QGraphicsDropShadowEffect(this); shadow_effect->setOffset(0, 0); //阴影颜色 shadow_effect->setColor(QColor(38, 78, 119, 127)); //阴影半径 shadow_effect->setBlurRadius(22); ui->frame->setGraphicsEffect(shadow_effect);}Widget::~Widget(){ delete ui;}

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。