Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QMLDIR and Singleton
Forum Updated to NodeBB v4.3 + New Features

QMLDIR and Singleton

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
1 Posts 1 Posters 195 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • F Offline
    F Offline
    final_software
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved