Is it possible to apply a color Gradient to Text in QML? If so, how? If not, what would be an acceptable means to achieve the same effect?
You can use LinearGradient QML Type.
import QtQuick 2.4
import QtQuick.Window 2.2
import QtGraphicalEffects 1.0
Window
{
visible: true
height: 500
width: 500
Text {
id: text
font.pointSize: 55
anchors.centerIn: parent
text: "Hello World!"
visible: false
}
LinearGradient {
anchors.fill: text
source: text
gradient: Gradient {
GradientStop { position: 0; color: "yellow" }
GradientStop { position: 1; color: "red" }
}
}
}
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments