Results 1 to 2 of 2

Thread: qt gridlayout with variable amount of widgets:scrollarea

  1. #1
    Join Date
    May 2018
    Posts
    1
    Qt products
    Qt5

    Default qt gridlayout with variable amount of widgets:scrollarea

    Hi,

    I have the following problem that I online don't find the solution for:

    I have a qt gridlayout and I want the widgets to have a certain minimumsize such that when there are more than X widgets, there comes a scrollarea.

    Does anyone know how I can program this?

    Its posted in the wrong category, I am searching for how to delete it/repost.

    Best regards,
    Wouter Devos

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: qt gridlayout with variable amount of widgets:scrollarea

    Put the QWidget with the QGridLayout as the main widget for a QScrollArea using QScrollArea::setWidget(). Call QScrollArea::setWidgetResizable() with "true". Add your widgets to the grid layout.

    Substitute the QScrollArea wherever you were originally using the widget with the QGridLayout.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. variable widgetsize in gridlayout
    By Surfman19 in forum Qwt
    Replies: 0
    Last Post: 4th August 2015, 08:53
  2. GridLayout widgets don't expand as expected
    By Qiieha in forum Qt Programming
    Replies: 2
    Last Post: 29th July 2015, 19:07
  3. sending amount of variable into button func
    By ramin.lich in forum Newbie
    Replies: 8
    Last Post: 23rd April 2015, 17:49
  4. Replies: 2
    Last Post: 3rd January 2012, 15:00

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.