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. How to calculate range in QScrollBar?
Forum Updated to NodeBB v4.3 + New Features

How to calculate range in QScrollBar?

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 2 Posters 263 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.
  • Q Offline
    Q Offline
    qwe3
    wrote on last edited by
    #1

    Hi,

    I have QScrollArea and big widget on it ( 1000x2000 ):

    this->setWidget(bigWidget);
    

    so QScrollArea has vertical QScrollBar too. I would like to know how can I calculate range values. When verticalScrollBar is up, the value is 0. I would like to know what is maximum Value ( when the verticallScrollBar will be on down ). When my BigWidget has height = 312, maximum value for verticallScrollBar is 1690.

    1690 + 312 = 2002 != 2000

    So why that 2?

    raven-worxR 1 Reply Last reply
    0
    • Q qwe3

      Hi,

      I have QScrollArea and big widget on it ( 1000x2000 ):

      this->setWidget(bigWidget);
      

      so QScrollArea has vertical QScrollBar too. I would like to know how can I calculate range values. When verticalScrollBar is up, the value is 0. I would like to know what is maximum Value ( when the verticallScrollBar will be on down ). When my BigWidget has height = 312, maximum value for verticallScrollBar is 1690.

      1690 + 312 = 2002 != 2000

      So why that 2?

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @qwe3
      the extra 2 pixel are coming either from the top/bottom border or margin/padding in a layout etc
      check the value returned from frameWidth() of the scrollarea widget

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      1 Reply Last reply
      2

      • Login

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