Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QScrollArea: Avoiding initial delay to scrolling
QtWS25 Last Chance

QScrollArea: Avoiding initial delay to scrolling

Scheduled Pinned Locked Moved Solved General and Desktop
qscrollarea
3 Posts 2 Posters 641 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.
  • V Offline
    V Offline
    VPaa 0
    wrote on 9 Aug 2019, 17:11 last edited by
    #1

    Hi,

    When you press down your mouse button on the arrow button at the end of a QScrollBar on a QScrollArea, the view nudges one bit, stops for a while and then begins continuous scroll.

    My question: How can I get rid of the wait before the continuous scroll?

    In the case of a normal button, the answer would probably be the QAbstractButton::autoRepeatDelay property. However, a QScrollBar lists no child widgets, so I wonder if there is any way to access the buttons of a QScrollBar.

    The stylesheet system allows access to the end buttons of a scrollbar, but setting ”qproperty-autoRepeatDelay” didn’t seem to work — maybe because the qproperty thing is promised to work for ”DESIGNABLE” properties only.

    Another approach would be to use the protected method QAbstractSlider::setRepeatAction, which takes thresholdTime and repeatTime as arguments. However, I haven’t managed to get it right.

    I am using Qt 4.7.

    Thanks for any help!

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 10 Aug 2019, 19:43 last edited by
      #2

      Hi,

      You can create your own QScrollBar so you can use the protected function and then set it on the QScrollArea.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      V 1 Reply Last reply 12 Aug 2019, 16:12
      0
      • S SGaist
        10 Aug 2019, 19:43

        Hi,

        You can create your own QScrollBar so you can use the protected function and then set it on the QScrollArea.

        V Offline
        V Offline
        VPaa 0
        wrote on 12 Aug 2019, 16:12 last edited by
        #3

        @sgaist Thanks for the comment. I got it working albeit the solution may be a little kludgy; I couldn't directly detect whether user's mouse click is upon one of the arrow buttons of a scrollbar, so I used a logic like this:

        When a signal fires to indicate a single-step movement to either direction,
        call QAbstractSlider::setRepeatAction to override the normal repetition pattern
        by a pattern without the delay. However, that override must be done only once per mouse-press, so I overrode QScrollBar::mousePressEvent so as to set a "sensitivity flag" for that purpose.

        1 Reply Last reply
        0

        3/3

        12 Aug 2019, 16:12

        • Login

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