Nominate our 2022 Qt Champions!

Have vertical scrollbar below horizontal qheaderview

  • Is there a way to set this? By default, vertical scrollbar goes all way up to the top of qtablewidget. QHeaderview does not need to be included for scrolling.

  • Lifetime Qt Champion


    AFAIK, no. You would have to implement that yourself.

  • @SGaist Sure I can. It would be nice to have it by a single func call.

  • One mediocre fix would be to set the stylesheet of the vertical scoll bar to have enough padding at the top. However, this will not extend the header view all the way to the right.

    Another quick hack would be the following:

    • permanently disable the vertical scrollbar of the table widget
    • create your own QScrollBar which you place perfectly on top of the QTableWidget
    • subscribe to the the table widget's resize and move events to resize and move your scrollbar accordingly (use inheritance or use installEventFilter() to be notified of size/position changes)
    • connect your own scrollbar back to the table widget

Log in to reply