Customizing a Gradient using QML
-
Hi all
i am developing a GUI that needs the gradients. The GUI has to follow some specific graphical guidelines that i could have to use for several projects. I have hence created some customization files for Button, Label and some other items. I have do the same with the Gradient: the code is thsi above:import QtQuick 2.0 import QtQuick.Controls 1.4; import QtQuick.Controls.Styles 1.4; Gradient { GradientStop { position: 0.0; color: "#004b87" } GradientStop { position: 0.75; color: "#d1d3d3" } GradientStop { position: 1.0; color: "#ffffff" } }
The filename is BlueGradient.qml. It is stored into the Resources/qml.qrc folder. I am now trying to apply it to a Rectangle:
Rectangle { property alias mouseArea: mouseArea property alias btn1: btn1 property alias label1: label1 width: 720 height: 720 gradient: BlueGradient
but the Rectange keeps having the default white background.
The debugger is showing me the following error
qrc:/MainForm.qml:12: ReferenceError: BlueGradient is not defined
-
hi,welcome to the forum!
You forgot {}
@CristianoNarcisiVidex said in Customizing a Gradient using QML:gradient: BlueGradient
gradient: BlueGradient{}
-
... ... ... Thanks a lot and sorry for posting this stupdi questions!!!