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. UI expnader component
Qt 6.11 is out! See what's new in the release blog

UI expnader component

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
7 Posts 3 Posters 2.0k 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.
  • JehyeokJ Offline
    JehyeokJ Offline
    Jehyeok
    wrote on last edited by
    #1

    Is there any UI component which is like 'Expander'? (refer below)
    collapse and expand component http://www.wpftutorial.net/Expander.html

    raven-worxR 1 Reply Last reply
    0
    • JehyeokJ Jehyeok

      Is there any UI component which is like 'Expander'? (refer below)
      collapse and expand component http://www.wpftutorial.net/Expander.html

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by
      #2

      @Jehyeok
      search in google for "qml collapsible" and you will find some examples

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      0
      • JehyeokJ Offline
        JehyeokJ Offline
        Jehyeok
        wrote on last edited by Jehyeok
        #3

        Sorry @raven-worx , I couldn't find right references.

        Actually
        I try to use 'Loader' to make similar putting Component or null in sourceComponent property.

                Loader {
                    id: itemLoader
                    anchors.fill: parent
                    visible: !collapsed
                    sourceComponent: collapsed ? null : componentItem
                }
        

        But, I don't think it is best. Because I need to put component in it still.

            MyExpander{
                componentItem: Component{
                    Rectangle{
                        Text {
                        }
                }
            }
        

        It would be nice to design as other layout components to hold children in it.
        Do you have any idea?

            GridLayout{
                Rectangle{
                    Text {
                    }
                }
            }
        
        raven-worxR 1 Reply Last reply
        0
        • JehyeokJ Jehyeok

          Sorry @raven-worx , I couldn't find right references.

          Actually
          I try to use 'Loader' to make similar putting Component or null in sourceComponent property.

                  Loader {
                      id: itemLoader
                      anchors.fill: parent
                      visible: !collapsed
                      sourceComponent: collapsed ? null : componentItem
                  }
          

          But, I don't think it is best. Because I need to put component in it still.

              MyExpander{
                  componentItem: Component{
                      Rectangle{
                          Text {
                          }
                  }
              }
          

          It would be nice to design as other layout components to hold children in it.
          Do you have any idea?

              GridLayout{
                  Rectangle{
                      Text {
                      }
                  }
              }
          
          raven-worxR Offline
          raven-worxR Offline
          raven-worx
          Moderators
          wrote on last edited by
          #4

          @Jehyeok said:

          Sorry @raven-worx , I don't get any reference from your keyword in google.

          come on... do you want me really to believe that?!

          Example 1, Example 2

          --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
          If you have a question please use the forum so others can benefit from the solution in the future

          JehyeokJ 1 Reply Last reply
          0
          • raven-worxR raven-worx

            @Jehyeok said:

            Sorry @raven-worx , I don't get any reference from your keyword in google.

            come on... do you want me really to believe that?!

            Example 1, Example 2

            JehyeokJ Offline
            JehyeokJ Offline
            Jehyeok
            wrote on last edited by
            #5

            @raven-worx You are right. I saw them in search results, but I mean it wasn't what I want. I want to have similar like groupbox component. http://doc.qt.io/qt-5/qml-qtquick-controls-groupbox.html

            1 Reply Last reply
            0
            • L Offline
              L Offline
              literA2
              wrote on last edited by
              #6

              You can do it like this:

              Rectangle {
                  implicitHeight: header.implicitHeight + (collapsed ? listview.contentHeight : 0)
                  Item {} // header
                  Listview {}
              }
              
              JehyeokJ 1 Reply Last reply
              0
              • L literA2

                You can do it like this:

                Rectangle {
                    implicitHeight: header.implicitHeight + (collapsed ? listview.contentHeight : 0)
                    Item {} // header
                    Listview {}
                }
                
                JehyeokJ Offline
                JehyeokJ Offline
                Jehyeok
                wrote on last edited by Jehyeok
                #7

                @literA2
                I would like to do it like this

                MyExpander{
                  GridLayout{
                    Rectangle{
                      Text { }
                      Text { }
                    }
                    Rectangle{
                      Text { }
                      Text { }
                    }
                  }
                }
                

                MyExpander is my new component. I would like to reuse this MyExpander object in other qml.
                Under the MyExpander should be able to control its children collapsible.

                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