有没有办法在QML中设置线性渐变stepwith

Is there a way to set the linear gradient stepwith in QML

我使用线性渐变为矩形着色。在我的显示器(480 像素,EGLFS)上,我可以清楚地看到 16 个色阶(见图)。有没有办法增加步数以获得更流畅的梯度。

梯度不好

Rectangle {
    width: 800
    height: 480
    gradient: Gradient{
        GradientStop{position: 1.0; color: "#404040"}
        GradientStop{position: 0.0; color: "black"}
    }
}

问题是渐变的颜色多于显示器可以显示的颜色(256 为 850)。这称为色带 (https://en.wikipedia.org/wiki/Colour_banding)。 通过使用指示的 .png 而不是渐变来减少颜色后,它看起来不错。