Skip to content
  • 0 Votes
    14 Posts
    2k Views
    VikramSamyV

    @jazzycamel said in modifying painter event in a LED class from solid color to Glowing color:

    @mpergand said in modifying painter event in a LED class from solid color to Glowing color:

    QRadialGradient gradient1(rec.center(), rec.width());
    gradient1.setColorAt(.0,Qt::red);
    gradient1.setColorAt(.9, Qt::transparent);
    painter.fillPath(path1,QBrush(gradient1));

    There is nothing wrong with QRadialGradient, just the way you are using it. When you construct the QRadialGradient, the first argument is the center point and the second argument is the radius not the diameter you want. If you change your first line to the following you will get the effect you expect:

    ... QRadialGradient gradient1(rec.center(), rec.width()/2); ...

    Hope this clears things up ;o)

    yup got the effects....thanks...