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. PathView keypressed handling could be better
Forum Updated to NodeBB v4.3 + New Features

PathView keypressed handling could be better

Scheduled Pinned Locked Moved QML and Qt Quick
4 Posts 2 Posters 2.3k 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.
  • P Offline
    P Offline
    phewat
    wrote on last edited by
    #1

    Hello all,

    PathView works great when you flick it but not so great when you use key presses. If you keep a key pressed for a while, you get key repeats that make the current index change very quickly (this is normal behavior). The thing is that if there aren't many items in the PathView (ex: 10), the animation doesn't have time to start moving towards one item that it has to move towards another in the other direction. What ends up happening is that the list skips around instead of turning around in one direction as you'd expect it.

    A way to fix this would be that instead of making the graphics go to the current index that remains in the bounds of the list, it should go to an index on which you don't apply a modulo. For example, it the bounds are [0..9], when you get to index 9, incrementing would get the "graphical index" to 10 and not 0. That way, the graphics keep on spinning until it reaches 10 which visually is the next 0.

    In the mean time, I have set highlightMoveDuration to 100 (default is 300ms). That way the spin is so fast that this problem doesn't occur. That said, a proper fix would be welcome.

    Cheers :)

    1 Reply Last reply
    0
    • P Offline
      P Offline
      phewat
      wrote on last edited by
      #2

      Here is an example:

      @import QtQuick 1.0

      Rectangle {
      width: 150; height: 150
      property real itemSize: 20

       PathView {
           id: spinner
           anchors.fill: parent
           model: 10
           delegate: Text { text: index; font.pointSize: itemSize - 4}
           focus: true
           //highlightMoveDuration: 100
           path: Path {
               startX: width - itemSize; startY: -itemSize/2
               PathLine { x: width - itemSize; y: spinner.count * itemSize}
           }
           Keys.onDownPressed: decrementCurrentIndex()
           Keys.onUpPressed: incrementCurrentIndex()
       }
       Text {
            text: "Press Up/Down to spin\nCurrent item index: " + spinner.currentIndex
       }
      

      }@

      Keep the Up or Down key pressed and you will see the numbers not spinning around as you'd expect.
      Remove the commented line to have it spin properly (but too fast...).

      1 Reply Last reply
      0
      • M Offline
        M Offline
        mbrasser
        wrote on last edited by
        #3

        Hi,

        Thanks for the information and example -- would you be able to add it as an official bug report using http://bugreports.qt.nokia.com (that way it is much more likely to be addressed, progress can be tracked, etc)?

        Thanks,
        Michael

        1 Reply Last reply
        0
        • P Offline
          P Offline
          phewat
          wrote on last edited by
          #4

          Hi Michael,

          I have created a new entry in the official bug report as you suggested:
          http://bugreports.qt.nokia.com/browse/QTBUG-18045

          Cheers :)

          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