通过qt方式来设置
QLinearGradient linearGrad(QPointF(0, 0), QPointF(200, 200)); linearGrad.setColorAt(0, Qt::darkGreen); linearGrad.setColorAt(1, Qt::yellow); QBrush brush(linearGrad); item->setBackground(brush);
设置从墨绿色到黄色的渐变色,如下图所示:
通过qt方式来设置
QLinearGradient linearGrad(QPointF(0, 0), QPointF(200, 200)); linearGrad.setColorAt(0, Qt::darkGreen); linearGrad.setColorAt(1, Qt::yellow); QBrush brush(linearGrad); item->setBackground(brush);
设置从墨绿色到黄色的渐变色,如下图所示: