January 25, 2012

Jacques Jacques
Ant Farmer
51 posts

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

 Signature 

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

4 replies

January 26, 2012

Jacques Jacques
Ant Farmer
51 posts

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

 Signature 

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

January 26, 2012

GentooXativa GentooXativa
Lab Rat
126 posts

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

Try this:

  1. onCurrentItemChanged: {
  2.      delegate->width = yourItem.width;
  3. }

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

 Signature 

Jose Vicente Giner Sanchez - Senior Mobile Developer

www.gigigo.com

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

January 27, 2012

ixSci ixSci
Lab Rat
203 posts

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

January 27, 2012

Jacques Jacques
Ant Farmer
51 posts

Hey everyone,

I did this with a simple code :

  1. import QtQuick 1.0
  2.  
  3. Rectangle {
  4.      width: 180; height: 200
  5.  
  6.      property int hauteurAC: 40
  7.  
  8.      ListView {
  9.          id:person
  10.          anchors.fill: parent
  11.          model: Model {}
  12.          delegate: ContactDelegate{}
  13.          highlight: Rectangle { color: "blue"; radius: 5 }
  14.  
  15.  
  16.          MouseArea{
  17.              anchors.fill:parent
  18.              onClicked: {
  19.                 hauteurAC = 60
  20.              }
  21.          }
  22.      }
  23.  }

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.

 Signature 

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

 
  ‹‹ [ASK] Can we add a MouseArea element into MapImage element?      [solved] representation of graph model ››

You must log in to post a reply. Not a member yet? Register here!