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. QScrollArea in QGridLayout in multiple cells

QScrollArea in QGridLayout in multiple cells

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 445 Views 1 Watching
  • 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.
  • M Offline
    M Offline
    m1smr
    wrote on last edited by
    #1

    Hello,

    I want to add a QScrollArea to a QGridLayout in multiple cells, but the QScrollArea does not use all horizontal space availavble.
    I added it like this: layout->addWidget(scrollArea, 0, 0, 1, 2, Qt::AlignCenter);

    The ScrollArea is in the center, but it does not use all horizontal space available. How do I do this?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      I think you need to say
      ui->scrollArea->setWidgetResizable( true );

      JonBJ 1 Reply Last reply
      0
      • mrjjM mrjj

        Hi
        I think you need to say
        ui->scrollArea->setWidgetResizable( true );

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @mrjj
        You're probably/doubtless right, but could you explain http://doc.qt.io/qt-5/qscrollarea.html#widgetResizable-prop

        If this property is set to true, the scroll area will automatically resize the widget in order to avoid scroll bars where they can be avoided, or to take advantage of extra space.

        It may fill the cell initially to "take advantage of extra space", as per OP's requirement, but when it gets filled with content will it "resize the [cell] widget to avoid scroll bars" when we want it to stay same size and scroll instead?

        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