#include
int main(int argv, char **args)
{
QApplication app(argv, args);
QLinearGradient linearGrad(QPointF(100, 100), QPointF(200, 200));
linearGrad.setColorAt(0, Qt::black);
linearGrad.setColorAt(1, Qt::white);
QBrush brush(linearGrad);
QWidget widget;
QPalette palette;
palette.setBrush(widget.backgroundRole(), brush);
widget.setPalette(palette);
widget.show();
return app.exec();
}