Reduce painting area of qwidget.



  • Hello All!
    I have a qtableview object and set my custom horizontal scroll bar(inherits QScrollBar)
    with

    setHorizontalScrollBar(new MyScrollBar(this));
    

    But I have problem, when scroll changes the range it gets repainted by the table So scrollbar is not visible. I want to reduce the painting area of qtableview to avoid scroll repainting. How is that possible?
    thank you.


  • Lifetime Qt Champion

    hi
    I have never tried this myself so might be silly question,
    If you set the qtableview to always show horz scrollbar (Qt::ScrollBarPolicy)
    and then replace it with your own. the size should fit?

    Or is because your new scrollbar is bigger? (than the std one)

    the docs says
    "When a scroll bar becomes visible again, the viewport shrinks in order to make room for the scroll bar."

    so it should just work by auto. So I wonder if the custom bar dont give correct size info?