Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Solved Scroll area not scrolling

    General and Desktop
    2
    3
    767
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • G
      graniteDev last edited by graniteDev

      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)
      {
          ui->sideBarScrollArea->setWidget(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?

      1 Reply Last reply Reply Quote 0
      • dheerendra
        dheerendra Qt Champions 2022 last edited by

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

        MainWindow w;
        w.resize(600,600);
        
        QScrollArea area;
        area.setWidget(&w);
        area.show();
        

        Dheerendra
        @Community Service
        Certified Qt Specialist
        http://www.pthinks.com

        1 Reply Last reply Reply Quote 0
        • G
          graniteDev last edited by

          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.

          1 Reply Last reply Reply Quote 0
          • First post
            Last post