Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. qml rowLayout
Qt 6.11 is out! See what's new in the release blog

qml rowLayout

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 922 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    San12
    wrote on last edited by
    #1

    want my window elements take the same height and width as the application window

    I want like when i click on one of the button , it displays on the rectangle , Could you please explain me how to do it because i searched but i didn't really understand

    i modify my code as many of you suggested but the probleme when i try marginleft property for the footer , nothing happened and my buttons aren't showing up , here is my code

    import QtQuick 2
    import QtQuick.Controls 2.15
    import QtQuick.Controls.Material 2.15
    import QtQuick.Layouts
    
    
    
    ApplicationWindow {
        id: applicationWindow
        property string displayedButton: ""
        width: 800
            height: 380
        visible: true
    
        Page {
            anchors.fill: parent
    
            RowLayout {
                anchors.fill: parent
    
                ListView {
                    id: leftMenuBar
                    Layout.preferredWidth: 90
                    Layout.fillHeight: true
                    clip: true
                    spacing: 10
                    model: 3
                    delegate: Button {
                        text: "Button " + (index + 1)
                        onClicked: displayedButton = text
                        width: 90
                        height: 90
                    }
    
                    Layout.alignment: Qt.AlignLeft
                    Layout.leftMargin: 20
                }
    
                Item {
                    Layout.fillWidth: true
                    Layout.fillHeight: true
    
                    Rectangle {
                        anchors.fill: parent
                        anchors.margins: 20
                        border.width: 2
                        border.color: "lightgray"
                        radius: 35
    
                        Text {
                            anchors.centerIn: parent
                            text: "Selected Button: " + displayedButton
                            font.pixelSize: 20
                        }
                    }
                }
            }
    
            footer: RowLayout{
    
    
                ListView {
                    id: bottomMenuBar
                    implicitHeight: 90
                    clip:true
    
                    orientation: ListView.Horizontal
                    spacing: 10
    
                    Layout.preferredWidth:90
    
    
    
                    Layout.leftMargin:20
    
    
                    Repeater {
                           model: 8
                           delegate: Button {
                               text: "Button " + (index + 1)
                               onClicked: displayedButton = text
                               width: 90
                               height: 90
                           }
                       }
    
    
                }
            }
    
    
        }
    

    And what i noticed when i made some modification , while i double click my window , button are displayed with random spacing , it that because i should use implicit height and width for them?

    ![alt text](![image url](159.PNG image url))

    please if you could help me

    SGaistS S 2 Replies Last reply
    0
    • S San12

      want my window elements take the same height and width as the application window

      I want like when i click on one of the button , it displays on the rectangle , Could you please explain me how to do it because i searched but i didn't really understand

      i modify my code as many of you suggested but the probleme when i try marginleft property for the footer , nothing happened and my buttons aren't showing up , here is my code

      import QtQuick 2
      import QtQuick.Controls 2.15
      import QtQuick.Controls.Material 2.15
      import QtQuick.Layouts
      
      
      
      ApplicationWindow {
          id: applicationWindow
          property string displayedButton: ""
          width: 800
              height: 380
          visible: true
      
          Page {
              anchors.fill: parent
      
              RowLayout {
                  anchors.fill: parent
      
                  ListView {
                      id: leftMenuBar
                      Layout.preferredWidth: 90
                      Layout.fillHeight: true
                      clip: true
                      spacing: 10
                      model: 3
                      delegate: Button {
                          text: "Button " + (index + 1)
                          onClicked: displayedButton = text
                          width: 90
                          height: 90
                      }
      
                      Layout.alignment: Qt.AlignLeft
                      Layout.leftMargin: 20
                  }
      
                  Item {
                      Layout.fillWidth: true
                      Layout.fillHeight: true
      
                      Rectangle {
                          anchors.fill: parent
                          anchors.margins: 20
                          border.width: 2
                          border.color: "lightgray"
                          radius: 35
      
                          Text {
                              anchors.centerIn: parent
                              text: "Selected Button: " + displayedButton
                              font.pixelSize: 20
                          }
                      }
                  }
              }
      
              footer: RowLayout{
      
      
                  ListView {
                      id: bottomMenuBar
                      implicitHeight: 90
                      clip:true
      
                      orientation: ListView.Horizontal
                      spacing: 10
      
                      Layout.preferredWidth:90
      
      
      
                      Layout.leftMargin:20
      
      
                      Repeater {
                             model: 8
                             delegate: Button {
                                 text: "Button " + (index + 1)
                                 onClicked: displayedButton = text
                                 width: 90
                                 height: 90
                             }
                         }
      
      
                  }
              }
      
      
          }
      

      And what i noticed when i made some modification , while i double click my window , button are displayed with random spacing , it that because i should use implicit height and width for them?

      ![alt text](![image url](159.PNG image url))

      please if you could help me

      SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      AFAIK, the way you try to use the footer is wrong. It's an horizontal area not an additional vertical space.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • S San12

        want my window elements take the same height and width as the application window

        I want like when i click on one of the button , it displays on the rectangle , Could you please explain me how to do it because i searched but i didn't really understand

        i modify my code as many of you suggested but the probleme when i try marginleft property for the footer , nothing happened and my buttons aren't showing up , here is my code

        import QtQuick 2
        import QtQuick.Controls 2.15
        import QtQuick.Controls.Material 2.15
        import QtQuick.Layouts
        
        
        
        ApplicationWindow {
            id: applicationWindow
            property string displayedButton: ""
            width: 800
                height: 380
            visible: true
        
            Page {
                anchors.fill: parent
        
                RowLayout {
                    anchors.fill: parent
        
                    ListView {
                        id: leftMenuBar
                        Layout.preferredWidth: 90
                        Layout.fillHeight: true
                        clip: true
                        spacing: 10
                        model: 3
                        delegate: Button {
                            text: "Button " + (index + 1)
                            onClicked: displayedButton = text
                            width: 90
                            height: 90
                        }
        
                        Layout.alignment: Qt.AlignLeft
                        Layout.leftMargin: 20
                    }
        
                    Item {
                        Layout.fillWidth: true
                        Layout.fillHeight: true
        
                        Rectangle {
                            anchors.fill: parent
                            anchors.margins: 20
                            border.width: 2
                            border.color: "lightgray"
                            radius: 35
        
                            Text {
                                anchors.centerIn: parent
                                text: "Selected Button: " + displayedButton
                                font.pixelSize: 20
                            }
                        }
                    }
                }
        
                footer: RowLayout{
        
        
                    ListView {
                        id: bottomMenuBar
                        implicitHeight: 90
                        clip:true
        
                        orientation: ListView.Horizontal
                        spacing: 10
        
                        Layout.preferredWidth:90
        
        
        
                        Layout.leftMargin:20
        
        
                        Repeater {
                               model: 8
                               delegate: Button {
                                   text: "Button " + (index + 1)
                                   onClicked: displayedButton = text
                                   width: 90
                                   height: 90
                               }
                           }
        
        
                    }
                }
        
        
            }
        

        And what i noticed when i made some modification , while i double click my window , button are displayed with random spacing , it that because i should use implicit height and width for them?

        ![alt text](![image url](159.PNG image url))

        please if you could help me

        S Offline
        S Offline
        San12
        wrote on last edited by
        #3

        @San12 i am still a beginner in qml , footer i used it tp place my buttom bottons , how could i correct it ?

        SGaistS 1 Reply Last reply
        0
        • S San12

          @San12 i am still a beginner in qml , footer i used it tp place my buttom bottons , how could i correct it ?

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          I would make the ListView horizontal. See the item documentation.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved