Three color QRadialGradient : QRadialGradient « Qt « C++






Three color QRadialGradient

  
#include <QtGui>

int main(int argv, char **args)
{
    QApplication app(argv, args);

    QRadialGradient radialGrad(QPointF(100, 100), 100);
    radialGrad.setColorAt(0, Qt::red);
    radialGrad.setColorAt(0.5, Qt::blue);
    radialGrad.setColorAt(1, Qt::green);

    QBrush brush(radialGrad);

    QWidget widget;
    QPalette palette;
    palette.setBrush(widget.backgroundRole(), brush);
    widget.setPalette(palette);
    widget.show();

    return app.exec();
}

   
    
  








Related examples in the same category

1.Draw in QRadialGradient
2.Create color from RGB value
3.Radial Gradient