Important: Please read the Qt Code of Conduct -

How can I permanently show scrollbars?

  • I want a set of scroll bars to be a permanent part of the UI. I want them to always be visible. The following snippet is not enough.


    I want the scroll bars to be visible even when they aren't necessary. How can I achieve this?

  • Qt Champions 2019

    @Kerndog73 Are you sure this scrollArea is the correct one? It looks like it is allocated on the stack. Where do you execute this code and can you show it?

  • @jsulm My actual code is slightly different. I'm deriving from QScrollArea. I'm also using custom QScrollBars. This is more similar to what I'm doing:

    class ScrollBar final : public QScrollBar {
      ScrollBar(Qt::Orientation orient, QWidget *parent)
        : QScrollBar{orient, parent} {}
    class ScrollArea final : public QScrollArea {
      explicit ScrollArea(QWidget *parent)
        : QScrollArea{parent} {
        setVerticalScrollBar(new ScrollBar{Qt::Vertical, this});
        setHorizontalScrollBar(new ScrollBar{Qt::Horizontal, this});

    Is Qt::ScrollBarAlwaysOn supposed to make the scrollbar always visible or am I experiencing expected behaviour?

  • Qt Champions 2019

    @Kerndog73 From documentation (
    "QAbstractScrollArea always shows a scroll bar. This property is ignored on systems with transient scroll bars (e.g., on Mac from version 10.7)."

    On which platform are you?

  • @jsulm I'm on a mac. Is there any way around this? Will I have to make my own scroll area from scratch if I want this behaviour? Maybe the scroll area could emulate scroll bars by setting content margins, responding to mouse events and painting? There must be a better way!

    BTW, how do I earn reputation on this site? Having to wait 10 minutes to reply is kind of annoying.

  • Qt Champions 2019

    @Kerndog73 Maybe you could use instead of the scroll area, but this means more work. Also, do you really want to work against platform UI design guidelines?

  • Lifetime Qt Champion


    I agree with @jsulm. What is your goal behind showing these scrollbars permanently on macOS ? It's been 7 versions since they are transient and everybody will expect that. Showing them permanently will make your application feel broken to your users.

  • @SGaist @jsulm I've been using macOS since Mavericks. I've given this quite a bit of thought and I think you're right. I should accept the defaults in this case.

Log in to reply