Tour Preview

Find the Best Demos and Examples

Check out this quick tour to find the best demos and examples for you, and to see how the Felgo SDK can help you to develop your next app or game!

Forums

OverviewFelgo 2 Support (Qt 5) › Stretch several buttons on device width

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #22882

    Anatol

    What is the standard way of stretching several buttons/ rectangles on full device width?

     

    I tried to use anchors and Column/Row in my example.

            Page {
                title: qsTr("Page")
    
                Column {
                    id: contentControl
                    anchors.left: parent.left
                    anchors.top: parent.top
                    anchors.right: parent.right
                    anchors.bottom: parent.bottom
                    Row {
                        spacing: 2
                        anchors.left: parent.left
                        anchors.top: parent.top
                        anchors.right: parent.right
                        Rectangle {
                            id: rectangle1
                            anchors.left: parent
                            width: (parent.width-2)/2
                            height: dp(100)
                            color: "#990000"
                            radius: 2
                        }
                        Rectangle {
                            id: rectangle
                            //anchors.right: parent
                            width: (parent.width-2)/2
                            height: dp(100)
                            color: "#009900"
                            radius: 2
                        }
                    }
    
                }
    
            }

     

     

    Layout alignment I want to create:

    1             2

    3             4

     

    1             2             3

    4             5             6

    7             8             9

     

     

     

    Regards

    #22899

    Alex
    Felgo Team

    Hi,

    you could use a Grid or GridLayout and calculate the number of used columns depending on the device width.

    Another approach would be using the Flow item.

    Cheers,
    Alex

Viewing 2 posts - 1 through 2 (of 2 total)

RSS feed for this thread

You must be logged in to reply to this topic.