使用样式定义:
QWidget* toolbar = new QWidget(this);toolbar->setObjectName("main_tool");toolbar->setStyleSheet("#main_tool{background: qlineargradient(x1:0 , y1:0 , x2:1 , y2:0,""stop:0 rgba(0,255,0, 0.2),""stop:0.2 rgba(0,255,0, 0.4),""stop:0.5 rgba(0,255,0, 0.5),""stop:0.8 rgba(0,255,0, 0.4),""stop:1 rgba(0,255,0, 0.2));}");