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. Minimize Groupbox
QtWS25 Last Chance

Minimize Groupbox

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 4 Posters 4.7k 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.
  • H Offline
    H Offline
    HTWAMD
    wrote on last edited by
    #1

    Hey,

    is there a way to minimize a groupbox and hide all the content inside? To show the content I want something like a drop-down button.

    Julien BJ 1 Reply Last reply
    0
    • p3c0P Offline
      p3c0P Offline
      p3c0
      Moderators
      wrote on last edited by
      #2

      @HTWAMD There is visible property if thats what you are trying to do.

      157

      1 Reply Last reply
      1
      • mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by
        #3

        well, if you have it in a layout
        You can set minimumHeight to adjust its size and show/hide its widgets but it will not work
        much like a dropdown button.

        More like area you collapse / expand

        1 Reply Last reply
        0
        • H HTWAMD

          Hey,

          is there a way to minimize a groupbox and hide all the content inside? To show the content I want something like a drop-down button.

          Julien BJ Offline
          Julien BJ Offline
          Julien B
          wrote on last edited by Julien B
          #4

          Hello @HTWAMD,

          Maybe Expander Control in QML is that you are looking for?

          In the example below you can click on the black rectangle to collapse/expand the group box

          Rectangle {
              id: rect1
              width: groupBox.width; height: groupBox.height
              y: 64
              x: 64
              color: "grey"
              anchors.top: rect2.bottom
              anchors.left: rect2.left
              clip: true
              GroupBox {
                  id: groupBox
                  //title: qsTr("Synchronize")
                  ColumnLayout {
                      anchors.fill: parent
                      CheckBox { text: qsTr("E-mail") }
                      CheckBox { text: qsTr("Calendar") }
                      CheckBox { text: qsTr("Contacts") }
                  }
              }
          
              Behavior on height { NumberAnimation { duration: 250 } }
          }
          Rectangle {
              id: rect2
              width: groupBox.width; height: 64
              y: 64
              x: 64
              color: "black"
              Text{
                  color: "white"
                  text: "synchronize"
                  anchors.centerIn: parent
              }
          
          
              MouseArea {
                  anchors.fill: parent
                  onClicked:
                      if (rect1.height === 0)
                          rect1.height = groupBox.height
                      else
                          rect1.height = 0
              }
          }
          
          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