PDA

View Full Version : List delegate flicks outside of container



prophet0
12th April 2012, 08:08
Container



Rectangle {
id: menuCont
width: 350; height: 301; x: -(parent.width * 500); y: 460;
color: "Black";

ListView {
id: menuListView; model: iconModel; delegate: Common.MenuDelegate { } z: 2
width: parent.width; height: parent.height; x: -(parent.width * 500); y: 460; cacheBuffer: 100;
spacing: 2; anchors.fill:parent

}
}


MenuDelegate



import QtQuick 1.0

Component {
Item {
id: wrapper; width: 344; height: 301
Item {
id: moveMe

Rectangle {
id: menuItem
width: 344; height: 57; color: "#00000000"; smooth: true
Image { source: "../Logic/images/textbox/directory.png" }

Behavior on opacity { PropertyAnimation { duration: 1000 } }
MouseArea { anchors.fill: parent; onClicked: menuItem.opacity = 0.2 }
}
Column {
x: 15; y: 15; width: wrapper.ListView.view.width
Text { text: xName; color: "white"; width: parent.width; font.pixelSize: 20; font.bold: true; elide: Text.ElideRight; style: Text.Raised; styleColor: "black" }
}
}
}
}



7581

if you look at the screen shot you see that the menuItem is outside of the menuListView
**Red lines show where the listview should reside

What am i doing wrong for this to happen?

Le_B
13th April 2012, 10:24
you need to set clip: true to your listview

prophet0
13th April 2012, 13:54
Thank you I have been searching forever

Again thanks very much works awesome