How to replace the default property in qt quick?



  • Hi everyone,
    I want to replace the property like header&ToolBar.
    For example, there is a property in ApplicationWindow called header. It can be replaced by ToolBar. like this:

    ApplicationWindow {
        visible:true
    
      header: ToolBar {
          RowLayout {
              anchors.fill: parent
              Item { Layout.fillWidth: true }
              Switch {
                  checked: true
                  text: qsTr("Notifications")
             }
          }
       }
    }
    

    The new ToolBar replace the ApplicationWindow‘s header, and it always at the top of ApplicationWindow.

    And now, i have some codes:

    Bar{
        id: titleBar
        property alias title: titleText
        //left controls
    
        property Item leftControls:
            ControlsList{
            parent: titleBar
            anchors.left: parent.left
            anchors.verticalCenter: parent.verticalCenter
        }
    
        //right controls
        property Item rightControls:
            ControlsList{
                parent: titleBar
                anchors.right: parent.right
                anchors.verticalCenter: parent.verticalCenter
        }
    

    How could i replace the leftControls or rightControls and don't change their layout? (。・・)ノ


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.