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

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