Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Extend Page container



  • Hello,
    I'm using Page container for design my application.
    Now I would like to extend Page by adding menu-section.

    screen.png

    I would like to behavior MyPage.qml was same like Page.
    Usage:

    MyPage{
    header:Text{
            text:"Hello"
        }
    
    menu:Text{
            text:"This is menu- here will be Column of button for example"
        }
    
    }
    

    How Can I do It right way?

    Now I do it like this: (but I suppose not good way)

    //MyPage.qml
    Page {
        property alias menuRect: menuRect
        property alias contentRect: contentRect
        Rectangle{
            id: menuRect
            anchors.top: parent.top
            anchors.bottom: parent.bottom
            anchors.right: parent.right
            width: 100
        }
        Rectangle{
            id: contentRect
            anchors.top: parent.top
            anchors.bottom: parent.bottom
            anchors.left: parent.left
            anchors.right: menuRect.left
        }
    }
    
    //use it: FirstPage.qml
    MyPage {
      Text{
            anchors.fill:menuRect
            text:"Hello"
        }
    
      Text{
            anchors.fill:contentRect
            text:"Hello"
         }
    }
    

Log in to reply