Increase size of a scrollbar of a textBrowser Widget



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


  • Moderators

    @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);
    


  • @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?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.