foreground property with QML Button
Unsolved
QML and Qt Quick
-
Hello,
I want to apply a columlayout to the QML button using foreground property. Based on the content i read from internet and QML documentations, i have developed the below example.
import QtQuick 2.15 import QtQuick.Window 2.2 import QtQuick.Controls 2.15 import QtQuick.Layouts 1.3 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Button { id: myButton text: "Click Me" foreground:ColumnLayout{ anchors.fill: parent Rectangle{ id:rect1 Text{ text: "Rect1" } } Rectangle{ id:rect2 Text{ text: "Rect2" } } } onClicked: { myButton.foreground.visible = !myButton.foreground.visible; // toggle visibility of foreground } } }
When i am trying to exevute i am facing the following error.
"cannot assign to non-existent property foreground", the versions that i am importing are QtQuick 2.15 & QtQuick.Controls.2.15
I know that there is a foreground property in Materials module of QML for changing color, but i wanted something like mentioned above.
Any help for the same will be helpful.
Thanks,