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.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support