How to create meshGradient (2-dimensional gradient)?

  • Some linearGradient code (1-dim) , but meshes (2-dim, example below) are needed.

        QLinearGradient linearGrad(screen.topLeft(), screen.bottomRight());
        QColor c1 = QColor::fromHsvF(0.3, 1, 0.3);
        QColor c2 = QColor::fromHsvF(0.4, 1, 0.5);
        QColor c3 = QColor::fromHsvF(0.5, 1, 0.3);
        linearGrad.setColorAt(0.1, c1);
        linearGrad.setColorAt(0.5, c2);
        linearGrad.setColorAt(0.9, c3);

    mesh examples:



    How to create mesh-gradient-background for scene?

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.