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...

  • 0 Votes
    2 Posts
    804 Views
    ?

    Hi!
    The following works:

    import QtQuick 2.4 import QtQuick.Controls 1.2 import QtGraphicalEffects 1.0 ApplicationWindow { title: "Upload Form" width: 800 height: 650 visible: true Item { id: myFunkyRectangle width: 300 height: 300 RadialGradient { id: gradient anchors.fill: parent gradient: Gradient { GradientStop { position: 0.0; color: "white" } GradientStop { position: 0.5; color: "black" } } visible: false } Rectangle { id: mask anchors { fill: parent; margins: 18 } color: "black" radius: 30 clip: true visible: false } OpacityMask { anchors.fill: mask source: gradient maskSource: mask } } }