Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8207897
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T09:09:10+00:00 2026-06-07T09:09:10+00:00

I have tried several things to get QScrollBar’s slider to change size based on

  • 0

I have tried several things to get QScrollBar’s slider to change size based on the number of singleSteps(). I would like the stepSize() to be ~1.

The following link has got me the closest, but I can’t seem to get it to work.

http://www.qtcentre.org/threads/2133-QScrollBar-custom-slider-s-size

What do I need to do to get the slider size to change? I would post code, however like I said above I have tried many different attempts, I would like to clean off my slate and just see a nice clean example of how to change the slider size.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T09:09:11+00:00Added an answer on June 7, 2026 at 9:09 am

    Normally the size of the slider is supposed to represent the size of the visible part of the scrolled content. That’s what QAbstractSlider‘s API was designed to do.

    If you want to lock the size of the visible part to be some integer multiple of a non-integer overall size of the content, then the idiomatic way to approach it is to rescale the output of the scrollbar by a non-integer factor height / (maximum() + pageStep()). The logical height (length) of the document maps to maximum() + pageStep(). You can of course set singleStep() to be equal to pageStep().

    Given some numStrips and height, proceed as follows:

    int numStrips;
    qreal height;
    
    int page = qRound(height/numStrips);
    int max = (numStrips - 1) * page;
    
    scrollBar->setMinimum(0);
    scrollBar->setMaximum(max);
    scrollBar->setPageStep(page);
    scrollBar->setSingleStep(page);
    
    qreal strip = scrollBar->value() * height / max;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried several things but I can't get the MySQL query in my
I have tried several things to get it work. Here is my problem. I
I have tried several things so far, but I haven't had much luck yet.
Here is what I have. I have tried several things but I can't figure
Can someone convert this english to SQL I have tried several things but no
I have tried several ways to login to a website through java. I have
I am stumped by this one. I have tried several angles and some come
I really need advice on how to do the following. I have tried several
I have tried this question on the site of Titanium and several tweets to
I have several tables in my database that have read-only fields that get set

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.