Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Unsolved Find out when a QScrollArea scrollbar is shown

    General and Desktop
    3
    6
    1070
    Loading More Posts
    • 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.
    • R
      reonZ last edited by reonZ

      I need to resize content inside a QScrollArea when the scrollbar is being shown due to ScrollBarAsNeeded policy, but there are no show or hide signals for QWidget nor did i find anything useful in QScrollBar or QAbstractSlider .

      What would be the procedure to do something like that ?

      1 Reply Last reply Reply Quote 0
      • Kent-Dorfman
        Kent-Dorfman last edited by

        Just thinking out loud, but what happens when you compare the size of the frame contained in the QScrollArea with the size of the QScrollArea itself? Does the child frame size() return its real size, or the visible size within the ScollArea? Test it and see...

        R 1 Reply Last reply Reply Quote 0
        • mrjj
          mrjj Lifetime Qt Champion last edited by

          Hi
          If its visible, this seems to return the status fine
          qDebug() << "is there : " << ui->scrollArea->verticalScrollBar()->isVisible();

          R 1 Reply Last reply Reply Quote 0
          • R
            reonZ @mrjj last edited by

            @mrjj I know i can test if it is visible, but it is not what i need here, i need to know when it become visible, to modify the values of some of the QWidget i have inside.

            1 Reply Last reply Reply Quote 0
            • R
              reonZ @Kent-Dorfman last edited by

              @Kent-Dorfman That is not an issue here, i can calculate the size of the area inside fine (that is already what i am doing), my problem is that sometimes there are no scrolbar and sometimes there is, when i calculate the size of my QWidget which is relative to the size of the inside area, i do it when i insert it, but by that point, the scrollbar is not there yet if it were to be.

              What i need is some kind of event that triggers when the scrollbar appears, so i can re-calculate everything.

              mrjj 1 Reply Last reply Reply Quote 0
              • mrjj
                mrjj Lifetime Qt Champion @reonZ last edited by

                @reonZ said in Find out when a QScrollArea scrollbar is shown:

                What i need is some kind of event that triggers when the scrollbar appears, so i can re-calculate everything.

                Well, you could use an eventfilter and watch for the showEvent for the scrollbar(s)

                1 Reply Last reply Reply Quote 1
                • First post
                  Last post