How to change QScrollArea width when vertical ScrollBar appears?

  • I have QScrollArea where widget with vertical tabbar placed. I want to increase its width when user resizes main window and vertical scrollbar apears (in order to not overlap its contents with appeared scrollbar). How can i do than? SizePolicy::expanding flag seems not helping.

  • Lifetime Qt Champion


    Your description is not really clear. How did you setup your widgets ?

  • @SGaist I have QFrame widget placed on MainWindow with horizontal layout. On the left part of this QFrame I have QScrollArea with fixed width and vertical layout. On this layout I placed QWidget with many toolbuttons. When user resizes MainWindow and its height decreases, part of tool buttons goes to invisible part of scrollArea and scrollbar apears. I want to increase width of this scroll area when this happens, in order to not overlap its contents with appeared scrollbar.
    I've tried to set the minimum and maximum widths differing by the horizontal size of this scrollbar, and set horizontalSizePolicy :: Expanding, but it didn't help.

  • Lifetime Qt Champion

    Why not set a minimal width that matched what is needed to show the content of the scroll area ?

Log in to reply