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. Resizing an element of ListView after a click on the element

Resizing an element of ListView after a click on the element

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 3 Posters 3.1k 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.
  • G Offline
    G Offline
    godbod
    wrote on last edited by
    #1

    Hello,

    Can someone help ? I need to resize the height of an element inside a ListView after a click on it. I managed to do it, but it does produce weird behavior. I mean, the height of one element takes a part of the other element just on the bottom... How can I keep each element coherent ?

    Thanks in advance for your help :)

    L'imagination est tout, c'est l’aperçu des futures attractions de la vie.

    1 Reply Last reply
    0
    • G Offline
      G Offline
      godbod
      wrote on last edited by
      #2

      Someone can help please ?
      Maybe my question is unclear, the point is expanding a delegate, how does it work ?

      L'imagination est tout, c'est l’aperçu des futures attractions de la vie.

      1 Reply Last reply
      0
      • G Offline
        G Offline
        GentooXativa
        wrote on last edited by
        #3

        Im not sure if i understand you, you want to resize the listview when you click on the element.

        Try this:

        @
        onCurrentItemChanged: {
        delegate->width = yourItem.width;
        }
        @

        Btw, your question is a bit unclear, try to post something more accurated or add a snippet of code.

        Jose Vicente Giner Sanchez - Senior Mobile Developer

        www.gigigo.com

        C/ Dr. Zamenhof 36bis, 1ºA 28027 Madrid
        T: +34 917431436

        1 Reply Last reply
        0
        • I Offline
          I Offline
          ixSci
          wrote on last edited by
          #4

          Hi godbod, probably you have set new height incorrectly. Post your code here so we can help you.

          1 Reply Last reply
          0
          • G Offline
            G Offline
            godbod
            wrote on last edited by
            #5

            Hey everyone,

            I did this with a simple code :

            @
            import QtQuick 1.0

            Rectangle {
            width: 180; height: 200

             property int hauteurAC: 40
            
             ListView {
                 id:person
                 anchors.fill: parent
                 model: Model {}
                 delegate: ContactDelegate{}
                 highlight: Rectangle { color: "blue"; radius: 5 }
            
            
                 MouseArea{
                     anchors.fill:parent
                     onClicked: {
                        hauteurAC = 60
                     }
                 }
             }
            

            }
            @

            and it does work !
            I am sorry, It seems to me that my application is not well designed somewhere as it's huge !
            Thanks though.

            L'imagination est tout, c'est l’aperçu des futures attractions de la vie.

            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