Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. [solved] Strange signals behavior with PathView ?
QtWS25 Last Chance

[solved] Strange signals behavior with PathView ?

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 1 Posters 3.9k Views
  • 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 Offline
    D Offline
    dmcr
    wrote on last edited by
    #1

    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
    0
    • D Offline
      D Offline
      dmcr
      wrote on last edited by
      #2

      currentItem was not initialized

      dmcr

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved