Important: Please read the Qt Code of Conduct -

How to make all elements in the Grid to fit in the screen?

  • Hello Everybody,
    I have divided the whole screen into 4 rectangels. Header, body into 2, footer.

    Now in the 2 nd rectangle from top. I have a grid with some elements as shown in fig. The problem is, the width of the screen is not enough to show all the data elements in Android. Can you please tell me what is the recommended procedure inorder to fit all the data elements in the screen. Thanks a lot.


    P.S: Android screen is locked in protrait mode.

    Header and footer are in separate qml file.

    body.qml // this is pushed into the stack using stackview. so the width and height are filled by stackview.

    Rectangle {
        width: 100
        height: 62
            height: parent.height/7
            width: parent.width
            Item {
                anchors.left: parent.left
                anchors.leftMargin: 20
                anchors.topMargin: 4
                    //                horizontalItemAlignment: Grid.AlignHCenter
                    //                verticalItemAlignment : Grid.AlignTop
                    columns: 10
                    rows: 3
                    columnSpacing: 4
                    rowSpacing: 1
                    // Layout.fillWidth:true
                        id: manualbutton
                        text: "Manual"
                        checked: true
                        onCheckedChanged: {
                            startRecordingButton.enabled= manualbutton.checked                       
                        exclusiveGroup: modeselection
    ....other elements like this....

  • Lifetime Qt Champion


    One way would be to have a ScrollView so you can move things from left to right or redesign that part to only show the selected option widgets and exploit all the available place.

Log in to reply