Qt 6.11 is out! See what's new in the release
blog
How to define QML gradient object in javascript
-
This is my qtquick qml code
function show_me(element) { console.log(element.gradient) } Rectangle { gradient: Gradient { GradientStop { position: 0 color: "#30cfd0" } GradientStop { position: 1 color: "#330867" } } MouseArea { anchors.fill: parent hoverEnabled: true onEntered: { show_me(parent) } } }The output is
qml: QQuickGradient(0x559f18a4dd40)the output gives me a QtQuickGradient object
I wonder how do I define a QtQuickGradient object in javascript?
I want to do something like:
var gradient = //QtQuickGradient (i don't know) element.gradient = gradientPlease help me to define it
-
Google: "qml dynamic objects"
https://doc.qt.io/qt-5/qtqml-javascript-dynamicobjectcreation.html