Congratulations to our 2022 Qt Champions!

Scroll area not scrolling

  • On the UI side, using QtCreator, I have a QScrollArea and I use this code to put a widget in it.

    void ServiceAppLayout::setSideBarWidget(QWidget *widget)

    This works fine, as the widget appears as expected, but if the widget is oversized, the scroll area doesn't offer scroll bars. What am I missing? How do I get the scroll bars to appear when needed?

  • Qt Champions 2017

    which platform ? Did you try with simple example like follows ? Does it work ?

    MainWindow w;
    QScrollArea area;

  • Ok, I figured it out, it had nothing to do with my code, or the scroll area. The widget that is handed to the scroll area has to have a layout defined, and all the visual elements need to be in that layout. This I discovered by accident this morning.

Log in to reply