Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. the size of the button in GridView does not change
Qt 6.12 LTS is out! See what's new in the release blog

the size of the button in GridView does not change

Scheduled Pinned Locked Moved Solved QML and Qt Quick
2 Posts 1 Posters 455 Views
  • 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.
  • I Offline
    I Offline
    Idodoqdo
    wrote on last edited by
    #1

    I want to rotate the button 90 degrees to rotate the text (since the button is custom, I can't access the text directly). I set the following conditions, but the size of the button does not change. Help me fix this

            GridView {
                id: gridOfPult
    
                Layout.fillHeight: true
                Layout.preferredWidth: parent.width * 0.7
    
    
                cellWidth: width / 3
                cellHeight: 40
    
                ListModel {
                    id: pultModel
    
                    ListElement {
                        name: ''
                    }
    
                    ListElement {
                        name: '<--'
                        rotationVal : 90
                    }
    
                    ListElement {
                        name: ''
                        rotationVal : 0
                    }
    
                    ListElement {
                        name: '<--'
                        rotationVal : 0
                    }
    
                    ListElement {
                        name: 'Enter'
                        rotationVal : 0
                    }
    
                    ListElement {
                        name: '-->'
                        rotationVal : 0
                    }
    
                    ListElement {
                        name: ''
                        rotationVal : 0
                    }
    
                    ListElement {
                        rotationVal : -90
                        name: '<--'
                    }
    
                    ListElement {
                        name: ''
                        rotationVal : 0
                    }
                }
    
                model: pultModel
    
                delegate:
                    Rectangle {
    
                    height: gridOfPult.cellHeight
                    width: gridOfPult.cellWidth
                    color: root.darkBackgroundColor
                    MyButton2 {
                        visible: name !== ''
                        rotation: rotationVal
                        height: rotationVal === 0 ? gridOfPult.cellHeight : gridOfPult.cellWidth
                        width: rotationVal === 0 ? gridOfPult.cellWidth : gridOfPult.cellHeight
                        anchors.fill: parent
                        anchors.margins: 2
                        text: name
                        onPressed: {
                            bhz.navigMenu(0)
                            print(height);
                            print(width);
                            //  bhz.enterMenu()
                        }
                    }
    
                }
    
            }
    

    f5fb3c15-60db-4157-a3cd-5898f11f3ed4-image.png

    1 Reply Last reply
    0
    • I Offline
      I Offline
      Idodoqdo
      wrote on last edited by
      #2

      I didn't bother and made alias txt.rotation

      1 Reply Last reply
      0
      • I Idodoqdo has marked this topic as solved on

      • Login

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