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. QML PathView: change current index of pathview via mouse wheel
Forum Updated to NodeBB v4.3 + New Features

QML PathView: change current index of pathview via mouse wheel

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 1.5k Views 1 Watching
  • 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.
  • A Offline
    A Offline
    alizadeh91
    wrote on 9 Mar 2014, 11:35 last edited by
    #1

    I have created a path view with a delegate and model. Is it possible to change current index of the PathView via mouse wheel instead of mouse click drag?

    Following is my PathView code:

    @PathView {
    id: pathView;
    anchors.fill: parent;
    model: sampleModel;
    delegate: delegate;
    path: Path {
    startX: 45; startY: 100
    PathAttribute { name: "iconScale"; value: 0.3 }
    PathAttribute { name: "iconOpacity"; value: 0.1 }
    PathQuad { x: 45; y: 300; controlX: 45; controlY: 200 }
    PathAttribute { name: "iconScale"; value: 1 }
    PathAttribute { name: "iconOpacity"; value: 1 }
    PathQuad { x: 45; y: 500; controlX: 45; controlY: 400 }
    }
    }@

    1 Reply Last reply
    0
    • O Offline
      O Offline
      onek24
      wrote on 10 Mar 2014, 09:34 last edited by
      #2

      Hey,

      i would go ahead and create a MouseArea where ever you need to catch the Mousewheel event. As you can see in the documentation, there is a onWheel(WheelEvent wheel) event.

      bq. This handler is called in response to both mouse wheel and trackpad scroll gestures.
      The wheel parameter provides information about the event, including the x and y position, any buttons currently pressed, and information about the wheel movement, including angleDelta and pixelDelta.

      Just create the notification in your MouseArea using onWheel: and handle it on your purpuses, that means increase or decreate the currentIndex of your PathView.

      For further information please read:
      "MouseArea onWheel":http://qt-project.org/doc/qt-5.0/qtquick/qml-qtquick2-mousearea.html#onWheel-signal

      1 Reply Last reply
      0

      1/2

      9 Mar 2014, 11:35

      • Login

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