Resizing an element of ListView after a click on the element



  • 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 :)



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



  • 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.



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



  • 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.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.