qt 使用样式设置渐变色背景
qt中使用样式设置渐变色背景
setStyleSheet()函数设置背景的前期是设置的窗口控件有父窗口
ui.widget->setStyleSheet("background-color:qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 #283345,stop:0.5 #151c26 ,stop:1 #020407)");
//为了避免子窗口中也设置为父窗口的相同格式,可以设置子窗口中的样式为透明
ui.child_widget->setStyleSheet("background:transparent");//其他参数按需求设置
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。