Listview onclick event
-
wrote on 15 Oct 2012, 12:37 last edited by
I have a listview with 5 items, onclicking them results in a rectangle with their properties. The starting point of the rectange is just beside the list. For instance if i clickon 5th element the rectangle is half sunk, as my width and height is limited. I want tat rectangle to start at a higher position: i tried to give x,y values but this does not work. I hope you have got my quesiton. If details are required, I will be more than happy to give them
Thanks in advance
-
wrote on 15 Oct 2012, 13:48 last edited by
The better way is to encapsulate the rectangle in the element, then set it visible only when necessary, in association with some state, for example.
-
wrote on 15 Oct 2012, 14:33 last edited by
hmm okay.. I will try.. Also, I want a screen behind the rectange which disables the listelement, so that the user is unable to click on the elements. any idea how to go about.?
-
wrote on 16 Oct 2012, 06:17 last edited by
Many way to do the job.
A Mousearea with a onReleased : {} or, wich is the proper way, using index & currentIndex to set the state of each element. -
wrote on 18 Oct 2012, 08:07 last edited by
I tried to encapsulate the rectangle but the problem is, its within Component.I cannot alter the x and y inside the component.
-
wrote on 18 Oct 2012, 08:18 last edited by
@// import QtQuick 1.0 // to target S60 5th Edition or Maemo 5
import QtQuick 1.1Rectangle {
id:main
width: 360
height: 360Component { id:contactdelegate Item { x: 5 height: 40 Row { id: row1 spacing: 10 Rectangle { width: 40 height: 40 color: colorCode } Text { text: name anchors.verticalCenter: parent.verticalCenter font.bold: true } } Text{ id:t1 text :"HELLO" }
}
}ListModel { id:listmodel ListElement { name: "Grey" colorCode: "grey" } ListElement { name: "Red" colorCode: "red" } ListElement { name: "Blue" colorCode: "blue" } ListElement { name: "Green" colorCode: "green" } } ListView { id: list_view1 x: 27 y: 62 clip:true width: 110 height: 160 delegate: contactdelegate model: listmodel }
}
@Is it possible for me to have the text "Hello" at the beginning of the main reactange at x,y:0 position??
Thanks in advance! -
wrote on 18 Oct 2012, 09:38 last edited by
I know this would be possible if u go outside the component and place it. But u want the text to be within the component.
1/7