Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. how to enable the QListWidget support touch event

how to enable the QListWidget support touch event

Scheduled Pinned Locked Moved Mobile and Embedded
10 Posts 6 Posters 7.8k 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.
  • X Offline
    X Offline
    xhsoldier
    wrote on last edited by
    #1

    As the title.
    Do not use the scroll bar to navigate the item, but just touch the screen to scroll up and down.

    Or any other options to implement a list that support touch?(not qml)

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mohsen
      wrote on last edited by
      #2

      re-implement a QListWidget class with mouseMove, mouseRelease and mousePress events

      1 Reply Last reply
      0
      • X Offline
        X Offline
        xhsoldier
        wrote on last edited by
        #3

        Yes. I do the same. stupid.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          chriadam
          wrote on last edited by
          #4

          Do you have to use a QListWidget? If you can use QML instead, try a flickable element.
          /edit: hrm, I clearly didn't read your question thoroughly; you said you can't use QML.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            andre
            wrote on last edited by
            #5

            Perhaps you should also look for the "flick charm" that was written a few years ago. It could still serve to inspire you.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mbnoimi
              wrote on last edited by
              #6

              I stucked with this issue since months ago :(

              May some one help us here and contribute with small snippet?

              1 Reply Last reply
              0
              • L Offline
                L Offline
                ltr6
                wrote on last edited by
                #7

                Try QScroller:

                http://qt-project.org/doc/qt-5/qscroller.html

                This might also help:

                http://qt-project.org/forums/viewthread/38529

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mbnoimi
                  wrote on last edited by
                  #8

                  [quote author="ltr6" date="1399363630"]Try QScroller:

                  http://qt-project.org/doc/qt-5/qscroller.html

                  This might also help:

                  http://qt-project.org/forums/viewthread/38529[/quote]

                  Thank you; but I really didn't understand how can I make my QListWidget supports Touch. I really need some simple snippet.

                  1 Reply Last reply
                  0
                  • L Offline
                    L Offline
                    ltr6
                    wrote on last edited by
                    #9

                    There was a snippet, I'll paste it here:

                    @QScrollerProperties sp;

                    sp.setScrollMetric(QScrollerProperties::DragVelocitySmoothingFactor, 0.6);
                    sp.setScrollMetric(QScrollerProperties::MinimumVelocity, 0.0);
                    sp.setScrollMetric(QScrollerProperties::MaximumVelocity, 0.5);
                    sp.setScrollMetric(QScrollerProperties::AcceleratingFlickMaximumTime, 0.4);
                    sp.setScrollMetric(QScrollerProperties::AcceleratingFlickSpeedupFactor, 1.2);
                    sp.setScrollMetric(QScrollerProperties::SnapPositionRatio, 0.2);
                    sp.setScrollMetric(QScrollerProperties::MaximumClickThroughVelocity, 0);
                    sp.setScrollMetric(QScrollerProperties::DragStartDistance, 0.001);
                    sp.setScrollMetric(QScrollerProperties::MousePressEventDelay, 0.5);

                    QScroller* scroller = QScroller::scroller(yourListWidget);

                    scroller->grabGesture(yourListWidget, QScroller::LeftMouseButtonGesture);

                    scroller->setScrollerProperties(sp);@

                    On lines 13 and 15 you need to give your list widget as the parameter.

                    1 Reply Last reply
                    0
                    • M Offline
                      M Offline
                      mbnoimi
                      wrote on last edited by
                      #10

                      Thank you a lot; I didn't expect it very easy. I thought the pointed code works for scrolling only.

                      xhsoldier. May you please set this thread as [SOLVED]

                      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