Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QGradient ColorInterpolation



  • Hello,

    i have some fundamental understanding question:
    Assume i create a Lineargradient this way (not even sure this is correct)

    QLinearGradient myIRGrad;
        myIRGrad.setStart(0, 0);
        myIRGrad.setFinalStop(0, 1);
        myIRGrad.setSpread(QLinearGradient::PadSpread);
        myIRGrad.setColorAt(0, Qt::red);
        myIRGrad.setColorAt(0.5, Qt::yellow);
        myIRGrad.setColorAt(0.9, Qt::white); 
    

    How i can get the interpolated color back at point, let say 0.333 ?
    The great qt docs are rather poor here or i search not smart enough.
    I expcted something like this:

    qDebug() <<  myIRGrad.ColorAt(0.333);
    

    but this does not work of course.
    I think i 'm on a total wrong way and need soemthing like QColormap or similar

    Any help highly welcome, thank you


Log in to reply