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");//其他参数按需求设置

猜你喜欢

转载自blog.51cto.com/sysq2012cto/2170107
今日推荐