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. Monitor QScrollArea's Bar Changes
Qt 6.11 is out! See what's new in the release blog

Monitor QScrollArea's Bar Changes

Scheduled Pinned Locked Moved General and Desktop
5 Posts 4 Posters 3.2k 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.
  • M Offline
    M Offline
    MamdouhAlShamy
    wrote on last edited by
    #1

    hi,

    how to monitor QScrollBarVertical Bar changes ?

    regards

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

      Connect to the relevant signal?
      You can get access to the scrollbars using QScrollArea::verticalScrollBar() and horizontalScrollBar().

      1 Reply Last reply
      0
      • G Offline
        G Offline
        giesbert
        wrote on last edited by
        #3

        have you tried to look in the docs?
        There are signals for each value change.

        Nokia Certified Qt Specialist.
        Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

        1 Reply Last reply
        0
        • M Offline
          M Offline
          MamdouhAlShamy
          wrote on last edited by
          #4

          thx 4 answers
          and srry 4 asking w/o deep search

          i wsolved with
          @
          QAbstractSlider *VBar= (QAbstractSlider *)scrollArea->verticalScrollBar();
          connect(VBar,SIGNAL(sliderReleased()),this, SLOT(Func()));
          @

          1 Reply Last reply
          0
          • G Offline
            G Offline
            goetz
            wrote on last edited by
            #5

            You must not cast to QAbstractSlider pointer type. A QScrollBar inherits from QAbstractSlider, so you can safely assign directly:

            @
            QAbstractSlider *VBar= scrollArea->verticalScrollBar();
            @

            And you're better off to assign it to a QScrollBar pointer, to have access to the other methods too, if necessary. And yes, you do have access to QAbstractSlider's methods and signals too.

            http://www.catb.org/~esr/faqs/smart-questions.html

            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