QToolBox and scrollbars taking the extra space ?



  • I am trying to get rid of a QScrollBar in a QToolbox because they (even not visible) take the space hence the QToolButton(s) do not expand horizontally to the full extent. I have tried to apply the style sheets like:

    QScrollBar:horizontal {
    height: 0px;
    width: 0px;
    }
    
    QScrollBar:vertical {
    height: 0px;
    width: 0px;
    }
    

    Did not help. Is there a way to use the scrollbar(s) space for the QToolButtons ?


  • Qt Champions 2016

    hi
    In win 7. Qt 5.5. setting your stylesheet on the
    QToolbox, does remove the scrollbar and allow me to
    let the widget go all way to the edge.

    http://postimg.org/image/kw3ypohl5/



  • @mrjj ,

    I am running a Windows 7 and Qt version 5.5.0/5.5/mingw492_32 libs ,

    hmm, very strange.

    P.S

    just notice a gap on the left side of the QToolButton on the provided picture ... is there a way to remove that one ?


  • Qt Champions 2016

    @ddze
    Hmm does seem very close to my version.

    • just notice a gap on the left side of the QToolButton on the provided picture
      Yes that is just the layouts "layoutLeftMargin" that default has 9. if u set to 0
      its aligned with left side.

    maybe u can try my test project and tell me if does the same for you
    https://www.dropbox.com/s/19ilrtzsyrsrv97/test.zip?dl=0

    Maybe you use another layout or something else so it seems to work for me and not for you.
    Maybe my sample is not working as u want it to. just looking like it :)



  • @mrjj ,

    Thanks so much , your example works fine on my pc too. So it must be something with the layout properties in my project.

    Strange, cause I checked all the buttons, and they are expanding with the stretch set above zero to take the extra space.

    But it is important for me to know that is workable.


  • Qt Champions 2016

    @ddze
    Ok that is good news.
    Its probably just something simple then.

    I set the layoutMargins (left and right ) on the layout i put inside
    QToolBox "page"/area.
    and then ur stylesheet.
    (just for the record)



  • @mrjj ,

    yes , you were right, the, I needed to LayoutStretch of docket widget to 1,1,1,1,1,1,1 and that has solved the expanding of the buttons. ( I thought the QButton size policy was enough , but a docket widget needed the stretch to expand the buttons).

    Thank you so much.


Log in to reply
 

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