Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Scroll area not scrolling
QtWS25 Last Chance

Scroll area not scrolling

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.2k Views
  • 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 Offline
    G Offline
    graniteDev
    wrote on last edited by graniteDev
    #1

    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
    0
    • dheerendraD Offline
      dheerendraD Offline
      dheerendra
      Qt Champions 2022
      wrote on last edited by
      #2

      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
      0
      • G Offline
        G Offline
        graniteDev
        wrote on last edited by
        #3

        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
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved