[Solved] QML LinearGradient along the x-axis
-
Following the documentation of "QtGraphicalEffects":https://qt-project.org/doc/qt-5.1/qtgraphicaleffects/qml-qtgraphicaleffects1-lineargradient.html#start-prop I tried to create a gradient along the x-axis.
At first this seems like something that is easy to do.
When changing the value of the end-property from
@end: Qt.point(0, 300)@
to
@end: Qt.point(300, 0)@
I am still left with the same gradient along the y-axis.Full code:
@
Item {
id: vrect
height: 300
width: 300LinearGradient { anchors.fill: parent start: Qt.point(0, 0) end: Qt.point(300, 0) gradient: Gradient { GradientStop { position: 0.0; color: "red" } GradientStop { position: 1.0; color: "green"} } } }
@
Result:
![URL=http://imgur.com/boNgC7R][IMG]http://i.imgur.com/boNgC7R.png[/IMG][/URL]!
Am I missing something obvious here?
-
Hi,
Your posted code works for me. Are you sure you are calling the right QML file ?
-
It is from Left to right.
-
Qt 5.1.0
-
Ok,
I forgot to reply to your earlier question about calling the correct qml file.
I was using an empty project with the code directly in the application window, so this could not be an issue.Now I now for sure its not a code issue I'll try some other venues in an attempt to resolve this (different project type / different Qt version / Qt without openGL / ...)
I'll also try on another PC since this one has some company group policies applied to it.
I'll post my findings as soon as I have resolved this issue.
Anyways, thank you for your help.