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. Cannot make multiple buttons in CheckDelegate or RadioDelegate
QtWS25 Last Chance

Cannot make multiple buttons in CheckDelegate or RadioDelegate

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 479 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.
  • S Offline
    S Offline
    summerfang
    wrote on last edited by
    #1

    I want to test CheckDelegate and RadioDelegate, however, when I directly use the following code from document, only the "Option 1" is showed. Cannot see "Option 2" and "Option 3". Am I doing something wrong?

    ListView {
        model: ["Option 1", "Option 2", "Option 3"]
        delegate: CheckDelegate {
            text: modelData
        }
    }
    
    ButtonGroup {
        id: buttonGroup
    }
    
    ListView {
        model: ["Option 1", "Option 2", "Option 3"]
        delegate: RadioDelegate {
            text: modelData
            checked: index == 0
            ButtonGroup.group: buttonGroup
        }
    }
    
    1 Reply Last reply
    0
    • Marco PellinM Offline
      Marco PellinM Offline
      Marco Pellin
      wrote on last edited by
      #2

      Remember:
      a ListView is correctly shown only if it has a certain size.
      Add width and height to it and everything will be fine ;)
      e.g.

          ListView {
              width: 400
              height: 600
              model: ["Option 1", "Option 2", "Option 3"]
              delegate: CheckDelegate {
                  text: modelData
              }
          }
      
      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