Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    [solved] Strange signals behavior with PathView ?

    QML and Qt Quick
    1
    2
    3759
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      dmcr last edited by

      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 ?

      dmcr

      1 Reply Last reply Reply Quote 0
      • D
        dmcr last edited by

        currentItem was not initialized

        dmcr

        1 Reply Last reply Reply Quote 0
        • First post
          Last post