QTableView - Transparent scrollbars background



  • Hello,

    I would like to know if is possible to style scrollbars like is shown in following screenshots:
    Screenshot
    I tried to use style:
    QScrollBar:vertical {
    border: transparent;
    background-color: transparent;
    width: 10px;
    margin: 0 0 0 0;}
    But scrollbar background still "hides" table rows...
    Can anyone help me please?

    Thanks, David.



  • @David.Reznicek little progress:

    QScrollBar:vertical {border: none;background-color: #282828;width: 10px;margin: 25px 0 0px 0;}\
    QScrollBar::handle:vertical{border-radius: 4px;border-color: rgba(216, 216, 216, 75%);border-width: 1px; border-style: solid; background-color: rgba(216, 216, 216, 75%); min-height: 25px;}\
    QScrollBar::add-line:vertical{width: 0px; height: 0px;}\
    QScrollBar::sub-line:vertical{width: 0px; height: 0px;}\
    QScrollBar::add-page:vertical{background-color: transparent;}\
    QScrollBar::sub-page:vertical{background-color: transparent;}\
    

    BUT QscrollBar is still not transparent :(


  • Moderators

    @David.Reznicek
    Thats because the viewport and the scrollbars are layouted side-by-side instead of stacked above.
    So you wont receive the result you want with QScrollArea directly.

    Either way you reimplement your custom scrollarea or you subclass QScrollArea, set the scrollbar policy of both scrollbars to "AlwaysOff" and add your custom scrollbars as a child to the viewport. Also you need to make sure that you reposition the scrollbars on resize and keep the hidden and custom scrollbars in sync.
    I haven't tried it, but i think it should work.



  • Thanks a lot..I'll try it.


Log in to reply
 

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