[solved] Strange signals behavior with PathView ?



  • Hello,

    these are the small code :

    Test.qml : @@import Qt 4.7

    Spinner {
    id: spinner
    width: 200; height: 240
    focus: true
    model: 30
    itemHeight: 30
    delegate: Text {
    font.pixelSize: 25; text: index; height: 30
    MouseArea{ anchors.fill : parent ;
    onClicked : console.log('currentIndex = '+ spinner.currentIndex )
    }
    }
    opacity : 1
    onCurrentIndexChanged : console.log('onCurrentIndexChanged')
    }
    @@

    in Spinner.qml : @@import Qt 4.7

    Image {
    property alias model: view.model
    property alias delegate: view.delegate
    property alias currentIndex: view.currentIndex
    property real itemHeight: 30
    source: "spinner-bg.png"
    clip: true

    PathView {
        id: view
        anchors.fill: parent
        pathItemCount: height/itemHeight
        preferredHighlightBegin: 0.5
        preferredHighlightEnd: 0.5
        highlight: Image { source: "spinner-select.png"; width: view.width; height: itemHeight+4 }
        dragMargin: view.width/2
        path: Path {
            startX: view.width/2; startY: -itemHeight/2
            PathLine { x: view.width/2; y: view.pathItemCount*itemHeight + itemHeight }
        }
    }
    

    }
    @@

    the indexChanged signal is only notified once clicked on the text, and there is some debugging message :

    QGraphicsItem::ungrabMouse: not a mouse grabber.

    I may miss something.

    Does anyone has an idea ?



  • currentItem was not initialized


Log in to reply
 

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