[solved] Items showed out of QListview range



  • This is my headache:

    !http://www.zoonman.ru/files/qt/s0.png(screenshot)!

    @

    import QtQuick 1.1

    Rectangle {
    width: parent.width - x -5
    height: parent.height - 250
    color: "#6e2535"
    radius: 10
    border.color: "#50000000"
    Component {
    id: highlight
    Rectangle {
    width: parent.width; height: 32
    color: "#2e262c"; radius: 5
    y: list_view1.currentItem.y
    }
    }

    Rectangle {
    id: scrollbar
    anchors.right: list_view1.right
    y: list_view1.visibleArea.yPosition * list_view1.height
    width: 10
    height: list_view1.visibleArea.heightRatio * list_view1.height
    color: "#fff"
    opacity: 0.1
    z: 3
    radius: 5
    }

    ListView {
    id: list_view1
    highlightRangeMode: ListView.ApplyRange
    preferredHighlightBegin: list_view1.height/2 - 36
    preferredHighlightEnd: list_view1.height/2 + 36
    keyNavigationWraps: true
    focus: true
    highlightFollowsCurrentItem: false
    maximumFlickVelocity: 5000 // влияет на скорость скроллинга
    highlight: highlight
    boundsBehavior: Flickable.StopAtBounds
    transformOrigin: Item.Top
    cacheBuffer: 10000
    width: parent.width
    height: parent.height
    contentWidth: parent.width-22
    contentHeight: 300
    delegate: Item {
    x: 5
    height: 32
    focus: true
    id: item1
    Row {
    id: row1
    Rectangle {
    width: parent.width
    height: 32
    border.color: "#000000"
    border.width: 1
    Image {
    x:2
    y:4
    id: nameImage
    width: 24
    height: 24
    source: ((sourcePath) ? sourcePath : "../../music/Afrojack/cover.jpeg")
    smooth: true
    }
    Text {
    focus: true
    x: 32
    text: name
    id: playlistTitle
    anchors.verticalCenter: parent.verticalCenter
    font.pointSize: 18
    MouseArea {
    focus: true
    anchors.fill: parent
    onClicked: {
    list_view1.highlightMoveSpeed = 10000
    list_view1.currentIndex = index;
    }
    }
    color: "#f6d7b1"
    }
    Rectangle {
    x:100
    width: parent.width - 100
    height: parent.height- 2
    anchors.fill: parent
    border.color: "#000000"
    }
    }
    }
    }
    model: ListModel {
    id: myModel
    ListElement {
    name: "Pendulum - The Island"
    colorCode: "grey"
    sourcePath: "../../music/Selena Gomez/cover.jpeg"
    }
    ListElement {
    name:"Ирина Салтыкова - Trust In You"
    colorCode: "red"
    sourcePath: "../../music/Ирина Салтыкова/cover.jpeg"
    }
    ListElement {
    name: "Selena Gomez & The Scene - Who Says (Bimbo Jones Radio Edit)"
    colorCode: "blue"
    }
    /* there are a lot of items */
    ListElement {
    name: "Red"
    colorCode: "red"
    }
    ListElement {
    name: "Blue"
    colorCode: "blue"
    }
    ListElement {
    name: "Green"
    colorCode: "green"
    }
    ListElement {
    name: "Grey"
    colorCode: "grey"
    }
    ListElement {
    name: "Pendulum - The Island"
    colorCode: "grey"
    sourcePath: "../../music/Selena Gomez/cover.jpeg"
    }
    ListElement {
    name:"Ирина Салтыкова - Trust In You"
    colorCode: "red"
    sourcePath: "../../music/Ирина Салтыкова/cover.jpeg"
    }
    }
    }
    }

    @

    How I can hide Items which out of Rectangle range?





  • Thank you sir! I just missed it in documentation. This is my fault.


Log in to reply
 

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