Unsolved QMLDIR and Singleton
-
Using PySide2, Qt Quick Controls, and Py Creator:
In my Project/qml/pages/settingsPage.qml, I created a switch:
Rectangle { id: rectangle1 width: 220 height: 60 visible: true color: "#2c303b" radius: 10 border.width: 0 Layout.fillHeight: false Layout.alignment: Qt.AlignLeft | Qt.AlignTop Layout.fillWidth: true anchors.leftMargin: 20 anchors.topMargin: 20 Switch { id: mySwitch anchors.left: parent.left anchors.top: parent.top anchors.bottom: parent.bottom display: AbstractButton.IconOnly spacing: 20 font.wordSpacing: 0 rightPadding: 0 padding: 0 font.pointSize: 15 onToggled: { //backend. } Label { id: labelTextName1 x: 120 width: 200 color: "#e8e9ec" text: qsTr("Switch") anchors.right: parent.right anchors.top: parent.top anchors.bottom: parent.bottom horizontalAlignment: Text.AlignHCenter verticalAlignment: Text.AlignVCenter anchors.rightMargin: -170 font.pointSize: 14 } } }
homePage.qml:
Item { id: item1 Rectangle { id: rectangle color: "#2c313c" //want to change this color anchors.fill: parent ... } }
How do I use qmldir and singleton? Where do I create the file and how do I edit the file using Py Creator? I tried putting module switchToggled and creating a singleton but I keep getting errors.