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. Increase size of a scrollbar of a textBrowser Widget
Qt 6.11 is out! See what's new in the release blog

Increase size of a scrollbar of a textBrowser Widget

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 2 Posters 1.8k 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.
  • B Offline
    B Offline
    bask185
    wrote on last edited by
    #1

    I have a QtextBrowser in which I can place a lot of text. When I do so a scrollbar appears but it is too small to use with my resistive touchscreen. So it needs to be biggah.

    I desperately tried in the setup:

    QScrollBar bar = new QScrollBar();
        bar.setSliderDown(true);
        bar.sizeIncrement().setWidth(50);
        bar.sizeIncrement().setHeight(20);
    
        ui->setupUi(this);
        ui->textBrowser->setVerticalScrollBar(bar);
    

    But is has no effect at all.
    alt text
    it's the bar in about the middle of the screen which needs to be biggah.

    Howcan????

    raven-worxR 1 Reply Last reply
    0
    • B bask185

      I have a QtextBrowser in which I can place a lot of text. When I do so a scrollbar appears but it is too small to use with my resistive touchscreen. So it needs to be biggah.

      I desperately tried in the setup:

      QScrollBar bar = new QScrollBar();
          bar.setSliderDown(true);
          bar.sizeIncrement().setWidth(50);
          bar.sizeIncrement().setHeight(20);
      
          ui->setupUi(this);
          ui->textBrowser->setVerticalScrollBar(bar);
      

      But is has no effect at all.
      alt text
      it's the bar in about the middle of the screen which needs to be biggah.

      Howcan????

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

      @bask185
      You can use stylesheets to set the width/height of a scrollbar.

      Since you use a touchscreen it would be even better to scroll by swiping. This can be achieved by simply add the following:

      scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
      QScroller::grabGesture(scrollArea, QScroller::LeftMouseButtonGesture);
      

      --- 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

      B 1 Reply Last reply
      0
      • raven-worxR raven-worx

        @bask185
        You can use stylesheets to set the width/height of a scrollbar.

        Since you use a touchscreen it would be even better to scroll by swiping. This can be achieved by simply add the following:

        scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        QScroller::grabGesture(scrollArea, QScroller::LeftMouseButtonGesture);
        
        B Offline
        B Offline
        bask185
        wrote on last edited by bask185
        #3

        @raven-worx said in Increase size of a scrollbar of a textBrowser Widget:

        @bask185
        You can use stylesheets to set the width/height of a scrollbar.

        Since you use a touchscreen it would be even better to scroll by swiping. This can be achieved by simply add the following:

        scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        QScroller::grabGesture(scrollArea, QScroller::LeftMouseButtonGesture);
        

        your code, I added it to the style sheet but it does not do anything. I am also unsure whether the swiping will work on target device. I am having flickering issues with the touchscreen. I cannot even control a QTumbler. The other system will work so I'd like to implement it anyways.

        How does the syntax look like for setting the width?

        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